Expand description
SQLite-backed request logging.
Every proxied request is logged to a SQLite database with its timestamp,
method, domain, path, action (allow/deny/ask/system-allow), and reason.
The database is accessed through an r2d2 connection pool (DbPool)
for thread-safe concurrent writes from async tasks.
The export submodule provides JSON and CSV export of all logs.
Modules§
- export
- Log export in JSON and CSV formats.
Structs§
- LogEvent
- A real-time log event broadcast to subscribers (e.g., web dashboard SSE).
- LogFilter
- Filter criteria for log queries.
- Request
Log - A single logged request record stored in the
requeststable. - Request
Stats - Aggregated request statistics from the
requeststable. - Timeline
Bucket - A single bucket in the timeline aggregation.
Functions§
- init_db
- Initialize the SQLite database and create the requests table if it doesn’t exist. Also runs migrations to add audit columns if they are missing.
- log_
request - Log a request to the database.
- open_db
- Open or create a SQLite database at the given path.
- open_
memory_ db - Open an in-memory SQLite database (for testing).
- open_
memory_ pool - Open an in-memory connection pool (for testing).
- open_
pool - Open a connection pool for the given database file path.
- query_
filtered - Query logs with flexible filters. All filters are combined with AND.
- query_
recent - Query the most recent N log entries.
- query_
stats - Query aggregated request counts grouped by action.
- query_
timeline - Query bucketed request counts per minute over the last N minutes.
Type Aliases§
- DbPool
- SQLite connection pool type alias (r2d2 + r2d2-sqlite).