Administration

Logs and tracing

Where each program writes its messages, how to switch on statement tracing and profiling in the SQL front-end, the watcher's event log, and fatal-error reports.

None of the programs writes a log file of its own, and none has a log-level option. Each writes to standard output and standard error; the service manager (systemd's journal, a scheduled task's output, a redirect) is the log.

raftdb-server#

WhatWhere
The start line raftdb-server listening on ADDR ..., data in DIRstandard output
raftdb-server: created .../admin.password ... and similar notices, start-up errorsstandard error
Replication and control eventsGET /v1/server (role, uptime, replication status, sync.degradedCommits) and GET /v1/control/state on a managed node

There is no access log and no slow-query log. A statement's trace is available in the SQL front-end (below).

raftdb-mysql#

VariableEffect
RAFTDB_MYSQL_TRACE=1 (any value)Logs to standard error each client login (connection N from IP: user NAME, client capabilities 0x..., plugin P) and each statement of COM_QUERY with its outcome: raftdb-mysql: [N] STATEMENT and -> error 1062: ..., -> ok, 3 rows, -> 12 rows or -> 2 answers.
RAFTDB_MYSQL_PROF=1 (any value)Prints one line per statement to standard error with where its time went (parse, plan, reads, send, ...). For developers measuring performance.

Both are read at start. Tracing writes every statement, including statements that contain passwords (CREATE USER ... IDENTIFIED BY ..., SET PASSWORD), so switch it on only for a short, private investigation and delete the output afterwards. Prepared-statement executions are not traced as text.

Start-up lines of raftdb-mysql:

raftdb-mysql: Raft DB server running in this process, listening on 127.0.0.1:7480 (binary protocol and HTTP)
raftdb-mysql: listening on 127.0.0.1:3307 (mysql protocol), version 8.0.36-Raft DB

raftdb-watch#

The watcher prints every event to standard error (so journalctl -u raftdb-watch shows them) and also delivers it to every configured channel: notify_file (one JSON line per event, an audit trail), notify_command and notify_webhook. One failing channel never blocks the others. See Monitoring with the watcher.

Fatal-error reports#

raftdb-server, raftdb-watch and raftdb-mysql write a report when they hit a fatal error: a panic in any thread, a failure to start, or the watcher unable to save its quorum state (decision D53). Reports are for the developers of Raft DB. They say what broke and where, never what data was involved.

Where reports go
Always: a local file<dir>/reports/<id>.json: the data directory for the server, the control directory for the watcher, the temporary directory or RAFTDB_ERROR_REPORT_DIR for raftdb-mysql. The newest 50 are kept.
Automatic delivery to raftdb.com, on by default in release builds, off with RAFTDB_ERROR_REPORT_REMOTE=off (needs curl; reports wait while offline)https://www.raftdb.com/api/report
Remote delivery to another serverRAFTDB_ERROR_REPORT_URL=http://host:port/path (plain HTTP: HTTP POST of the JSON, with Authorization: Bearer <RAFTDB_ERROR_REPORT_TOKEN> if set; any 2xx is "received"), or RAFTDB_ERROR_REPORT_COMMAND=program (run with the report's path as its argument, 15 s limit: use it for HTTPS with a script that calls curl).
SwitchesRAFTDB_ERROR_REPORT=off disables everything; RAFTDB_ERROR_REPORT_DETAIL=full keeps the whole message instead of the cleaned one.
Unsent reportsStay in <dir>/reports/pending/ and are retried at the next start.

A report holds id, instance (a random id of this installation, no host name), component, version, os, arch, time, uptimeSeconds, kind, place (file:line), thread, message, detail and stack (function names of Raft DB, std and core only). The message is cleaned: quoted text, paths, e-mail and network addresses and long numbers are removed, and it is cut at 300 characters. No keys, rows, SQL or credentials are ever included. The same report is sent at most once per 10 minutes, at most 20 per hour, and a crash waits at most 3 seconds to deliver one.

When you report a bug, attach the newest local report file if there is one.

See also#