Ignition Gateway serves the log page by querying a local SQLite database. Follow the request from the browser to route-group=status, through route-path=/logs, into GatewayLoggingManagerImpl and SQLiteAppenderReader, and finally to system_logs.idb. When database maintenance holds the file, another process retains a connection, or the database is damaged, the query stops at the SQLite layer and the log list can alternate between populated and empty states.
Where does the log request travel and stop?
Layer one first. The relevant physical path is the gateway host's storage: on the reported Raspberry Pi 4 installation, that means the filesystem and its underlying storage. Confirm that the filesystem accepts persistent writes before treating the failure as a web or SQL problem. A read-only or overlay-backed filesystem can discard a deletion at reboot and reveal the previous files again.
| Stage | Component or identifier | Failure indication |
|---|---|---|
| Client | Gateway web log list | The list flashes between empty and populated states, reported about every 10 seconds. |
| Web route |
route-group=status, route-path=/logs
|
The request reaches the gateway logging route. |
| Logging service | GatewayLoggingManagerImpl.queryLogEvents |
The service requests events from the database reader. |
| Query builder | SQLiteAppenderReader.buildPrepStatement |
java.sql.SQLException: Unable to build a valid query with the parameters provided. |
| Database | system_logs.idb |
[SQLITE_BUSY] The database file is locked (database is locked) identifies a lock at statement preparation. |
The displayed query error is therefore not, by itself, proof of database corruption. The stack trace and the nested SQLite exception decide whether the immediate cause is contention, query construction, or a damaged database. If the web page cannot display the details, read wrapper.log directly from the gateway filesystem.
Which symptoms distinguish cleanup, locking, and corruption?
| Symptom or observation | Probable mechanism | Next diagnostic |
|---|---|---|
| Large log database, scheduled maintenance, and temporary web-log errors | Cleanup is deleting old records while the web route attempts a read. | Correlate Starting logfile maintenance with the query-error timestamps. |
[SQLITE_BUSY] appears in the nested exception |
Maintenance or another connection holds the SQLite file lock. | Stop external access to the log files and allow maintenance to finish. |
Unable to build a valid query with the parameters provided without a nested lock error |
The request failed while the reader built or prepared the query. | Capture the complete stack trace from wrapper.log, including every Caused by line. |
| Errors continue after contention and maintenance have stopped | The logging database may be damaged. | Shut down the gateway and rebuild system_logs.idb. |
| Deleted logs return with old content after a host reboot | The operating system, disk image, backup, or overlay filesystem is restoring prior storage state. | Delete while the gateway is stopped, reboot, and test whether an unrelated file change also persists. |
Only wrapper.log behaves unexpectedly |
Wrapper logging and SQLite event logging are separate paths. | Inspect rollover settings in ignition.conf. |
Two installations provide useful version boundaries without defining a universal affected-version range: one reported the condition on 8.0.6; another saw it after moving from 8.1.19 to 8.1.22. Diagnose the exception and maintenance timing on the installed version rather than assigning every occurrence to an upgrade defect.
Which recovery approach fits the failure?
| Approach | Use it when | Effect | Tradeoff |
|---|---|---|---|
| Let maintenance finish | The failure overlaps scheduled cleanup and then clears. | Preserves retained events while pruning the oldest records. | A large excess can take multiple maintenance cycles. |
Tune data/logback.xml
|
The database repeatedly reaches its entry or size thresholds. | Changes retention and the amount of work performed per cleanup. | Larger cleanup batches can hold resources longer; smaller batches reduce the database more gradually. |
| Remove competing access | The nested exception is SQLITE_BUSY. |
Releases the file for the gateway reader and appender. | The competing script, utility, backup, or file scanner must be identified. |
Rebuild system_logs.idb
|
Errors persist when maintenance is idle and no other connection is present. | Creates a fresh internal log database at gateway startup. | Deletes retained gateway log events. |
| Correct storage persistence | Old files return after deletion and reboot. | Makes filesystem changes survive a host restart. | The correction belongs to the operating-system or storage configuration. |
Start with maintenance correlation because the reported large database recovered after cleanup completed. Use configuration tuning if the condition repeats. Rebuild only the SQLite event database when the lock has cleared but queries still fail. Reinstalling the gateway is unnecessary for a recoverable log-database problem and does not correct an overlay filesystem that restores old data.
Why can normal log maintenance block the web page?
The SQLite appender stores events in one database file and periodically removes old rows. A maintenance operation and the web reader can contend for that file. One captured sequence reported Max entries: 50000 and Max filesize: 104857600, followed by Starting logfile maintenance and then an error on /logs. Cleanup was observed taking more than five seconds, long enough for a concurrent web request to fail.
| Setting | Shown value | Function |
|---|---|---|
entryLimit |
50000 |
Maximum target entry count. The database can temporarily contain more because cleanup is periodic. |
maxEventsPerMaintenance |
5000 |
Event count that can trigger a maintenance cycle. |
minTimeBetweenMaintenance |
60000 |
Minimum interval between maintenance operations; it takes precedence over the event trigger. |
vacuumFrequency |
3 |
Number of maintenance cycles between vacuum operations that recover disk space. |
diskspaceCleanupEventCount |
500 |
Oldest events removed when the maximum database size is exceeded. |
maxDatabaseSize |
104857600 bytes |
Database-size threshold that triggers size-based cleanup. |
Most stored events were described as occupying approximately 600–800 bytes on disk. That is an event-size estimate, not a database-capacity formula; indexes, pages, free space, and SQLite overhead also consume the file. A list containing about 260,000 entries can exceed the configured retention target because entryLimit is enforced during maintenance rather than synchronously on every insert. With size cleanup removing 500 old events per cycle, reduction is incremental.
How should the maintenance settings be changed?
The maintenance block in a fresh data/logback.xml is commented out. Activating it turns the displayed values into explicit configuration. Change one retention dimension at a time so the resulting database size, maintenance duration, and event history remain attributable to that change.
- Copy the existing
data/logback.xmlbefore editing it. - Record the current database size, approximate event count, and timestamps of
Scheduling logfile maintenance,Starting logfile maintenance, and the query failure. - Choose the controlling objective: use
entryLimitto target an event count andmaxDatabaseSizeto cap database growth by bytes. - Set
diskspaceCleanupEventCountaccording to the required recovery rate. Increasing it removes more old rows after a size breach but can lengthen an individual maintenance operation. - Use
maxEventsPerMaintenanceandminTimeBetweenMaintenanceto control how often maintenance runs. The time limit takes precedence over the event-count trigger. - Restart or reload the gateway by the configuration-management method used for the installation, then watch
wrapper.logthrough at least one maintenance cycle.
Do not point scripts or database utilities at system_logs.idb while the gateway is running. SQLite file locking protects transactional integrity, and an extra connection can produce SQLITE_BUSY even when retention settings are reasonable.
How can a damaged log database be rebuilt safely?
Rebuild the internal event database only after capturing the complete error from wrapper.log. Removing every file from the logs directory mixes separate logging systems and discards evidence needed to diagnose the failure.
- Stop the Ignition Gateway so no writer or reader holds the database.
- Preserve a copy of
wrapper.logand the failedsystem_logs.idbif the exception must be investigated later. - Delete only
system_logs.idbfrom the logs directory. On the reported Linux installation, the directory was/usr/local/ignition/logs/. - Start the gateway. The logging subsystem creates a new
system_logs.idb. - Open the gateway log page and confirm that new events appear without a query exception.
After a clean deletion and startup, the expected initial files were a new system_logs.idb and a single wrapper.log until wrapper rollover occurs. The wrapper file is managed by the service wrapper, and its rollover configuration belongs in ignition.conf, not the SQLite maintenance block.
Why can deleted logs return after a reboot?
Ignition creates a new empty log database when its database file is absent; it does not repopulate that file with deleted historical events. If old events return, follow the storage path below the application. An overlay filesystem can present a read-only base image while holding changes in volatile storage. Rebooting discards the volatile layer and exposes the old base copy again. A restored disk image or backup can produce the same visible result.
- Stop the gateway and verify that its process no longer has the log files open.
- Delete
system_logs.idb, then confirm the file is absent before restarting the gateway. - Create or modify a harmless test file outside the Ignition directory, reboot the host, and check whether that change persists.
- Inspect the Raspberry Pi operating-system configuration for an overlay or read-only filesystem if both changes revert.
- If the file reappears while the gateway remains stopped, inspect operating-system restore, imaging, and backup processes rather than the Ignition logging configuration.
How is the fix verified from end to end?
- Monitor activity directly with
tail --follow wrapper.log. This retains message line breaks and captures traffic that can bypass the database-backed log viewer. - Open the gateway log page and generate normal log activity without repeatedly refreshing during an active maintenance operation.
- Confirm that
/logsreturns records and that neitherUnable to build a valid query with the parameters providednor[SQLITE_BUSY]appears. - Wait for the next scheduled maintenance cycle and measure the interval from its start to completion.
- Confirm that the retained event count and
system_logs.idbsize move toward the configured limits. - When storage persistence was part of the fault, reboot the host once and verify that the newly created database remains current rather than reverting to deleted historical data.
FAQ
Why does the Ignition Gateway log page flash empty?
The /logs request can collide with SQLite maintenance while old events are being removed. Correlate the flashing interval with Starting logfile maintenance in wrapper.log and check for SQLITE_BUSY.
Why does Ignition exceed the 50000-entry log limit?
entryLimit is a maintenance target, so the database can temporarily contain more than 50000 events. Size-based cleanup removes 500 oldest events per cycle with the shown diskspaceCleanupEventCount, making recovery from a large excess gradual.
How do I verify that rebuilding system_logs.idb worked?
Start the gateway, follow wrapper.log, open the log page, and confirm that new events appear without the query error or SQLITE_BUSY. Then observe one maintenance cycle and perform a reboot if old files previously returned.