# Error executing query against logs database

**URL:** <https://forum.inductiveautomation.com/t/error-executing-query-against-logs-database/67224>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [December 5, 2022, 11:06am UTC](https://forum.inductiveautomation.com/t/error-executing-query-against-logs-database/67224 "2022-12-05T11:06:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![janne.p](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@janne.p](https://forum.inductiveautomation.com/u/janne.p)\
**Post date:** [December 5, 2022, 11:06am UTC](https://forum.inductiveautomation.com/t/error-executing-query-against-logs-database/67224/1 "2022-12-05T11:06:49Z")

</div>

After updating from version 8.1.19 to 8.1.22 the logging issue came with errors

What could be the reason and is there something what could be done.

Same issue was found few years back on early access thread:

[Gateway log: Error executing query against logs database](https://forum.inductiveautomation.com/t/gateway-log-error-executing-query-against-logs-database/33769)

```auto
INFO | jvm 1 | 2022/12/05 12:52:59 | True
INFO | jvm 1 | 2022/12/05 12:52:59 | Good
INFO | jvm 1 | 2022/12/05 12:52:59 | Mon Dec 05 12:52:29 EET 2022
INFO | jvm 1 | 2022/12/05 12:52:59 | True arvo
INFO | jvm 1 | 2022/12/05 12:53:00 | Scheduling logfile maintenance. Last maintenance: Mon Dec 05 12:51:58 EET 2022, events since then: 1
INFO | jvm 1 | 2022/12/05 12:53:00 | Starting logfile maintenance. Max entries: 50000, Max filesize: 104857600
INFO | jvm 1 | 2022/12/05 12:53:03 | E [c.i.i.g.l.SQLiteAppenderReader] [10:53:03]: Error executing query against logs database. route-group=status, route-path=/logs
INFO | jvm 1 | 2022/12/05 12:53:03 | java.sql.SQLException: Unable to build a valid query with the parameters provided.
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.logging.SQLiteAppenderReader.buildPrepStatement(SQLiteAppenderReader.java:129)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.logging.SQLiteAppenderReader.query(SQLiteAppenderReader.java:154)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.logging.GatewayLoggingManagerImpl.queryLogEvents(GatewayLoggingManagerImpl.java:144)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.web.pages.status.routes.LoggingRoutes.getLogs(LoggingRoutes.java:561)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.dataroutes.Route.service(Route.java:254)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.dataroutes.RouteGroupImpl.service(RouteGroupImpl.java:61)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.dataroutes.RouteGroupCollectionServlet.serviceInternal(RouteGroupCollectionServlet.java:59)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.dataroutes.AbstractRouteGroupServlet.service(AbstractRouteGroupServlet.java:38)
INFO | jvm 1 | 2022/12/05 12:53:03 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.servlet.ServletHolder$NotAsync.service(ServletHolder.java:1450)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:799)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1631)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:548)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:600)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1624)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1440)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:501)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1594)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1355)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.catapult.handlers.RemoteHostNameLookupHandler.handle(RemoteHostNameLookupHandler.java:121)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.rewrite.handler.RewriteHandler.handle(RewriteHandler.java:322)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:59)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.Server.handle(Server.java:516)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:487)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:732)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:479)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:277)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:555)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:410)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:164)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:338)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:315)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:173)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:409)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:883)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1034)
INFO | jvm 1 | 2022/12/05 12:53:03 | at java.base/java.lang.Thread.run(Unknown Source)
INFO | jvm 1 | 2022/12/05 12:53:03 | Caused by: org.sqlite.SQLiteException: [SQLITE_BUSY] The database file is locked (database is locked)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.DB.newSQLException(DB.java:1141)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.DB.newSQLException(DB.java:1152)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.DB.throwex(DB.java:1112)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.NativeDB.prepare_utf8(Native Method)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.NativeDB.prepare(NativeDB.java:117)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.DB.prepare(DB.java:267)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:44)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:25)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.jdbc4.JDBC4Connection.prepareStatement(JDBC4Connection.java:34)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:155)
INFO | jvm 1 | 2022/12/05 12:53:03 | at org.sqlite.jdbc3.JDBC3Connection.prepareStatement(JDBC3Connection.java:135)
INFO | jvm 1 | 2022/12/05 12:53:03 | at com.inductiveautomation.ignition.gateway.logging.SQLiteAppenderReader.buildPrepStatement(SQLiteAppenderReader.java:110)
INFO | jvm 1 | 2022/12/05 12:53:03 | ... 52 common frames omitted
INFO | jvm 1 | 2022/12/05 12:53:05 | Cleaned up 500 rows in 5504 ms. Vacuum performed: true*

```

---

<div class="post-metadata">

**Author:** ![janne.p](https://avatars.discourse-cdn.com/v4/letter/j/7ea924/32.png) [@janne.p](https://forum.inductiveautomation.com/u/janne.p)\
**Post date:** [December 5, 2022, 11:36am UTC](https://forum.inductiveautomation.com/t/error-executing-query-against-logs-database/67224/2 "2022-12-05T11:36:13Z")

</div>

Now when the log file size is smaller and within boundaries the errors are stopped.

```auto
INFO | jvm 1 | 2022/12/05 13:29:33 | Scheduling logfile maintenance. Last maintenance: Mon Dec 05 13:28:32 EET 2022, events since then: 0
INFO | jvm 1 | 2022/12/05 13:29:33 | Starting logfile maintenance. Max entries: 50000, Max filesize: 104857600
INFO | jvm 1 | 2022/12/05 13:29:36 | Cleaned up 500 rows in 2918 ms. Vacuum performed: true*

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 5, 2022, 12:56pm UTC](https://forum.inductiveautomation.com/t/error-executing-query-against-logs-database/67224/3 "2022-12-05T12:56:16Z")

</div>

In the future, don't post the same question in multiple places. You posted this over here first:

> [@Gateway log: Error executing query against logs database](https://forum.inductiveautomation.com/t/gateway-log-error-executing-query-against-logs-database/33769/9):
>
> After updating from version 8.1.19 to version 8.1.22 this issue came INFO | jvm 1 | 2022/12/05 12:52:59 | True INFO | jvm 1 | 2022/12/05 12:52:59 | Good INFO | jvm 1 | 2022/12/05 12:52:59 | Mon Dec 05 12:52:29 EET 2022 INFO | jvm 1 | 2022/12/05 12:52:59 | True arvo INFO | jvm 1 | 2022/12/05 12:53:00 | Scheduling logfile maintenance. Last maintenance: Mon Dec 05 12:51:58 EET 2022, events since then: 1 INFO | jvm 1 | 2022/12/05 12:53:00 | Starting logfile maintenance…

Double-posting is against this forum's [rules](https://forum.inductiveautomation.com/faq).
