Skip to content

Observability ​

ferrixd exposes three windows into a running server: Prometheus metrics, structured tracing logs (human-readable or JSON), and the ferrixd check validator for catching problems before they're running problems. For a live look without any of that, there is ferrixd ctl status and the admin dashboard.

Prometheus metrics ​

Enable the endpoint in the config:

toml
[metrics]
bind = "127.0.0.1:9090"

Scrape http://127.0.0.1:9090/metrics — standard text exposition format, no dependencies, no auth (so bind to loopback or a private interface and let your Prometheus reach it there).

yaml
# prometheus.yml
scrape_configs:
  - job_name: ferrixd
    static_configs:
      - targets: ["127.0.0.1:9090"]

What you get (full catalogue with types: Metrics reference):

MetricWatch it for
ferrixd_clientscurrent population; drops = netsplit or mass disconnect
ferrixd_channelschannel count
ferrixd_connections_totalaccept rate; spikes = connect flood
ferrixd_commands_total / ferrixd_messages_totaltraffic shape
ferrixd_sendq_drops_totalclients too slow to drain their queue
ferrixd_flood_disconnects_totalrate-limit kills — abuse or a broken bot
ferrixd_registration_timeouts_totalconnect-and-stall behavior, port scans
ferrixd_command_duration_secondsper-command handler latency (histogram, command label)
ferrixd_tls_cert_not_after_secondscertificate expiry — alert well before it (renewal broken?)
ferrixd_plugin_traps_totala plugin that traps has stopped enforcing its policy (fail-open)
ferrixd_dnsbl_*_totalblocklist lookups, hits, timeouts and skips per zone

The three …_total disconnect counters map one-to-one to the DoS controls: SendQ overflow, token bucket exhaustion ("Excess Flood"), and registration timeout. A healthy server shows them near zero; a server under attack shows you which control is absorbing it.

Alerting ideas ​

yaml
# Sudden loss of >20% of clients in 5m (netsplit / crash-loop upstream)
- alert: FerrixdPopulationDrop
  expr: ferrixd_clients < 0.8 * max_over_time(ferrixd_clients[15m])
  for: 5m

# Sustained flood kills
- alert: FerrixdFloodKills
  expr: rate(ferrixd_flood_disconnects_total[5m]) > 1
  for: 10m

# Certificate expires within 14 days (renewal failing)
- alert: FerrixdCertExpiring
  expr: ferrixd_tls_cert_not_after_seconds - time() < 14 * 86400

# A plugin is trapping (and therefore no longer enforcing anything)
- alert: FerrixdPluginTraps
  expr: increase(ferrixd_plugin_traps_total[10m]) > 0

Logging & tracing ​

ferrixd logs through tracing with per-connection spans: every log line produced while handling a connection carries that connection's context (remote address, nick once registered), so one misbehaving client can be followed through the log without grepping for guesses.

Control verbosity with the standard RUST_LOG grammar, either via the environment or the CLI (the flag wins) — or change it on a running server without a restart: ferrixd ctl log-level "info,ferrixd::link=debug".

sh
ferrixd --log info
ferrixd --log debug                       # verbose: per-command detail
ferrixd --log "info,ferrixd::link=debug"  # module-targeted: debug S2S only

Format and color:

sh
ferrixd --log-format pretty     # human-friendly multi-line (development)
ferrixd --log-format compact    # terse single lines
ferrixd --log-format full       # default
ferrixd --log-format json       # one JSON object per line, for log pipelines
ferrixd --color never           # for log shippers that dislike ANSI

The same defaults can live in the config file, so a container or unit file needs no flags (the flags still win):

toml
[logging]
format = "json"
filter = "info,ferrixd::link=debug"

JSON logs ​

json writes exactly one object per line to stdout — the startup banner is replaced by a server.start event so the stream stays machine-readable. Event fields are flattened to the top level next to timestamp, level, message and target:

json
{"timestamp":"2026-12-01T14:15:54.88Z","level":"INFO","message":"S2S link established","event":"link.up","peer":"hub.example","sid":"1AB","protocol":"ferrix","target":"ferrixd::link"}

Key events carry a stable event field, so a pipeline can match on it instead of on the human-readable message (which may be reworded):

eventLevelFields
server.startinfoversion, server, network, sid, tls_bind, dev
server.shutdowninfocause (sigint, sigterm, die, restart)
server.restart / server.reexecwarn / infooper / exe
nick.forcedinfopeer, old, new, reason
control.command / control.deniedinfo / warncmd, args (passwords redacted)
server.drainwarngrace_secs
multiclient.attach / multiclient.detached / multiclient.expiredinfopeer, nick, connections / nick / count
account.registered / account.verified / account.droppedinfoaccount (peer, verified on registration)
account.verification_failedwarnaccount, err
account.expiredinfocount
account.oper_changeinfooper, account, change
service.up / service.rejectedinfo / warnpeer, service, distribution
connection.accepteddebugpeer
connection.rejectedinfo/debugpeer, cause (dline, kline, per_ip_limit, dnsbl), reason
connection.closedinfopeer, elapsed, reason
oper.up / oper.failedinfo / warnoper, mask
rehashinfo / warnoper, ok, err
tls.reloadinfocause (file_change when the watcher installed it), cert
tls.reload_failedwarncert, err
tls.acme_issued / tls.acme_failed / tls.acme_placeholderinfo / warn / warndomains / err, retry_secs
link.up / link.downinfopeer, sid, protocol
plugin.trapwarnplugin, err
plugin.actionwarnplugin, action (gline/connect/squit), detail, outcome
plugin.revoked / plugin.refusedwarn / errorplugin, capability / err
plugin.bot_up / plugin.bot_downinfoplugin, nick / reason

These names are part of the 1.x stability promise; new events and fields may be added.

Under systemd, plain stdout logging lands in the journal:

sh
journalctl -u ferrixd -f

Notable events at info and above include listener startup, S2S link establishment/loss (with peer names), plugin loads and traps, OPER attempts, K/D-line hits, and every disconnect with its reason.

ferrixd check — the third pillar ​

Observability starts before startup. check loads the config and builds the TLS material, then prints a colorized summary of exactly what a run would start: listeners, limits, accounts/operators/bans counts, persistence, metrics, links, plugins.

sh
ferrixd -c /etc/ferrixd/ferrixd.toml check

Non-zero exit on any problem — put it in CI and in your deploy pipeline, and REHASH (or restart) only after it passes.

Correlating the three ​

A worked example — "users complain about disconnects":

  1. Metrics: rate(ferrixd_sendq_drops_total[5m]) is climbing → clients aren't draining their queues.
  2. Logs: filter for SendQ exceeded — the spans name the nicks and IPs; it's one bouncer host with a saturated uplink.
  3. Config: decide — raise sendq_lines for legitimate slow consumers, or let the control do its job.

Every disconnect reason a control produces (SendQ exceeded, Excess Flood, Registration timeout, Ping timeout, K-line reasons) is both a log line and, for the first three, a metric increment — the two views always agree.

Dual-licensed under MIT or Apache-2.0.