authcha learn

Learn / Operations

Monitoring, metrics and the audit trail

Module 5 of 6 · 25 minutes

By the end you can

  • Choose the console views that answer common questions
  • Turn on the metrics listener safely and write the key alerts
  • Explain how stuck accounting sessions are cleaned up
  • State how long audit data is kept and how to search the archive

What to watch in the console

WhereWhat it answers
DashboardIs authentication healthy, and is anything needing attention?
Live Auth → MetricsAccepts, rejects and errors per minute, top users and devices, updating live
Live Auth → LogsThe live RADIUS log, filterable by user, device address and result
Audit Trail → Auth HistoryEvery authentication attempt and its result
Audit Trail → OTP FunnelCodes requested, sent and verified. Shows provider problems quickly
SessionsActive and past network sessions
SystemContainer health and console backups

Latency percentiles (p50 and p99) on the metrics page appear only after you set LATENCY_CAPTURE_ENABLED=true in .env and recreate freeradius. They are off by default because of a small per-request cost.

Metrics for Prometheus

The console can expose Prometheus metrics on a separate listener. It is off until you set, in .env:

METRICS_BIND=127.0.0.1:9188
# or, for a scraper on another host:
# METRICS_BIND=0.0.0.0:9188
# METRICS_TOKEN=<at least 16 random characters>

Then docker compose up -d admin. A non-loopback address requires a token of at least 16 characters. Without one the listener refuses to start, and it logs why. The endpoint is never served through the console's public port, it is plain HTTP so put TLS in front of it for a remote scraper, and answers are cached for 10 seconds.

Metrics carry no secrets and no personal data: labels are fixed words (result, event, state), never a user, device or destination name.

Alerts worth having

AlertWhy
Console down (up == 0 for 3 minutes)Nothing can be administered
authcha_ops_up == 0Settings and certificate changes fail
authcha_collector_ok == 0A section of the metrics cannot be collected
CA or server certificate expiring (authcha_ca_expiry_days_min < 30)802.1X and RadSec break when they lapse
authcha_license_days_left < 30New provisioning pauses after expiry
Reject ratio above half of recent loginsA broken device, a wrong secret or an attack
SIEM behind (authcha_siem_lag_events_max high)Security events are not reaching your SIEM
authcha_enforcement_unenforced_sessions > 0A limited user the firewall could not be told about
authcha_kek_configured == 0 or plaintext keysSecrets stored unencrypted

Also monitor RADIUS itself with a synthetic login from a registered test client, disk space on the host, and the backup and restore-drill logs.

Accounting sessions that never stopped

A device that loses power never sends its Accounting-Stop. Left alone, its sessions would stay open forever in Network Sessions, in quotas and in enforcement connectors. Every minute the console closes an open session that has had no interim update for 3 times its interim interval (600 seconds if the policy sets none), but not sooner than 5 minutes after its last update. The session is stopped at its last update time with the terminate cause Lost-Service, and enforcement connectors get the same stop event as for a real one. A session that never received any interim update waits 24 hours. The metric authcha_accounting_sweep_last_run shows the sweep is alive.

The audit trail

  • Every change made through the console or API is recorded under Audit Trail → Admin Actions: who, what, when and from which address. That includes license installs, setting changes and SSO sign-ins.
  • The console deletes admin audit entries older than ADMIN_AUDIT_RETENTION_DAYS (default 180) each day. Set it in Settings → Admin Security; 0 keeps entries in the database indefinitely.
  • The scheduled audit-retention job applies a 180-day window to the console audit log, OTP events, failed sign-ins and the RADIUS authentication log. It archives before it deletes, to compressed JSON-lines files in /opt/authcha/backups/audit-archive/, which only root can read.
  • 180 days matches common security-log retention rules. If your rules need a shorter window, lower the setting. If they need a longer one, keep the archives.

Search an archive with:

gunzip -c /opt/authcha/backups/audit-archive/admin_audit_log-*.jsonl.gz | grep '"alice"'

LabHands-on

  1. Open Live Auth and the Metrics page on the demo (viewer login demo-viewer, password Authcha-View-2026). Find the accept and reject rates.
  2. Open Audit and filter for a type of change. See who, what and when.
  3. On your install, set METRICS_BIND=127.0.0.1:9188, recreate admin, and run curl -s 127.0.0.1:9188/metrics | head.
  4. Pick two alerts from the table and write them as Prometheus rules.
  5. Look at /opt/authcha/backups/audit-archive/ and search an archive for one username.
  6. Set METRICS_BIND=0.0.0.0:9188 without a token and confirm the listener refuses to start (read the log). Add a token and try again.

Check yourselfQuiz

1You bind metrics to a non-loopback address. What else is required?
2What do metric labels never contain?
3A switch loses power with sessions open. How do those sessions end?
4When the audit-retention job removes old logs, what does it do first?
5Which of these needs LATENCY_CAPTURE_ENABLED=true?

Cheat sheetKeep this

  • Views: Dashboard, Live Auth (metrics and logs), Auth History, OTP Funnel, Sessions, System.
  • Prometheus: METRICS_BIND, and a token (16+ chars) for any non-loopback address. Plain HTTP, no secrets in labels.
  • Alert on: console down, ops down, cert expiry under 30 days, license under 30 days, reject spikes, SIEM lag, unenforced sessions, no encryption key.
  • Stuck sessions close after 3 intervals, minimum 5 minutes, as Lost-Service.
  • Audit: 180 days by default, archived to backups/audit-archive/ before deletion.
  • Read more: Operations, SIEM streaming.