Skip to main content
Anubis exposes Prometheus metrics and health check endpoints for monitoring and observability.

Metrics Server

Anubis runs a separate metrics server on port 9090 by default.

Configuration

Endpoints

Prometheus Metrics

Policy Results

Tracks how many requests matched each rule and what action was taken:
Labels:
  • rule - Bot rule name from policy file
  • action - Action taken: ALLOW, DENY, CHALLENGE, WEIGH
Example queries:

Available Metrics

Anubis exposes these metric families:

Health Checks

HTTP Health Check

Status codes:
  • 200 OK - Anubis is serving traffic
  • 500 Internal Server Error - Anubis is not ready
  • 424 Failed Dependency - Unknown health state

CLI Health Check

Anubis includes a built-in health check command:
Use cases:
  • Docker HEALTHCHECK
  • Kubernetes liveness/readiness probes
  • Systemd watchdog

Integration Examples

Docker

Docker Compose

Kubernetes

Liveness Probe

ServiceMonitor (Prometheus Operator)

Prometheus

Scrape Config

Alert Rules

Grafana Dashboard

Example dashboard panels:

Request Rate by Action

Visualization: Time series (stacked area)

Top Rules

Visualization: Bar gauge

Challenge Success Rate

Requires application-level instrumentation (not built-in).

Logging

Anubis uses structured logging (JSON format) with configurable levels.

Log Levels

Or via policy file:

Log Sinks

Standard Error (Default)

Logs to stderr. Captured by Docker, Kubernetes, systemd.

File with Rotation

Old logs are compressed: anubis.log.2026-03-03T12:00:00Z.gz

Structured Log Fields

Key fields:
  • rule - Matched rule name
  • action - Action taken
  • remote_addr - Client IP
  • subsystem - Component (anubis, metrics, config-validate)

Log Aggregation

Loki (Grafana)

Elasticsearch

Use Filebeat or Fluentd to ship JSON logs to Elasticsearch.

Observability Best Practices

Metrics

Do:
  • Monitor challenge/deny rates for attack detection
  • Set alerts for abnormal traffic patterns
  • Track per-rule metrics to optimize policy
  • Monitor Go runtime metrics (memory, goroutines)
🚫 Don’t:
  • Ignore sustained high deny rates (possible attack)
  • Set metrics scrape interval too low (< 15s)
  • Expose metrics endpoint to the internet

Logging

Do:
  • Use structured logging (JSON) for easy parsing
  • Set appropriate log level (INFO for production)
  • Rotate log files to prevent disk space issues
  • Aggregate logs to centralized system
🚫 Don’t:
  • Use DEBUG level in production (too verbose)
  • Log to files without rotation
  • Disable logging entirely
  • Ignore error-level log messages

Health Checks

Do:
  • Configure liveness and readiness probes
  • Use /healthz for automated monitoring
  • Set reasonable timeout/retry values
  • Monitor health check endpoint availability
🚫 Don’t:
  • Set health check interval too low (< 10s)
  • Use main application port for health checks
  • Ignore health check failures

Troubleshooting

Metrics Not Scraped

Symptom: Prometheus shows up{job="anubis"} == 0 Check:
Fix: Ensure --metrics-bind is accessible from Prometheus.

High Memory Usage

Symptom: process_resident_memory_bytes growing unbounded Possible causes:
  • Memory storage backend without limits
  • DNS cache growing too large
  • Log file handles not closed
Fix: Switch to persistent storage backend (bbolt, valkey).

Missing Metrics

Symptom: No anubis_policy_results metrics Cause: No traffic matching policy rules Verify:

Next Steps