1. Overview
The Logs Viewer module provides a lightweight, read-only interface to display runtime security logs generated by the Clamonacc backend. The page is designed for continuous monitoring and troubleshooting, without allowing any modification of log content from the UI.
The module periodically polls the backend log provider and refreshes the displayed text in place.
2. User Interface Structure
2.1 Text View
The page is implemented as a vertical GTK container holding a single scrollable text view.
The log viewer uses:
- A read-only
Gtk::TextView(textView) - A dedicated text buffer (
Gtk::TextBufferviabuffer) - A
Gtk::ScrolledWindowto support continuous scrolling and long output
UI configuration details:
- Editing is disabled (
set_editable(false)) - Monospace mode is enabled (
set_monospace(true)) for log readability
3. Log Refresh Model
3.1 Periodic Refresh Timer
The module schedules an automatic refresh every 5 seconds using a GLib timeout:
Glib::signal_timeout().connect_seconds(..., 5)
The timer callback is implemented by:
bool LogPage::update_logs()
The callback returns true to keep the timer active.
3.2 Backend Log Source
Each refresh cycle retrieves log lines using:
Backend::getClamonaccLogs()
The returned list of strings is concatenated into a single text blob separated by newline characters and then written into the text buffer via:
buffer->set_text(text)
4. Runtime Behavior
At runtime, the page continuously:
- Polls the backend log provider every 5 seconds
- Replaces the entire displayed log content with the latest retrieved log set
- Maintains a simple, predictable UI behavior suitable for monitoring
The implementation is intentionally minimal: it does not attempt incremental updates, filtering, or log-level parsing at the UI level.
5. Design and Security Considerations
- Read-only view: the UI cannot modify logs and is strictly a viewer.
- Backend ownership: log collection and formatting remain the responsibility of the backend layer.
- Operational simplicity: full-buffer replacement avoids partial-update inconsistencies but may be less efficient on extremely large logs.
- Monitoring use-case: monospace rendering improves readability for technical and forensic review.