Metrics Server
Anubis runs a separate metrics server on port 9090 by default.Configuration
Endpoints
| Path | Description |
|---|---|
/metrics | Prometheus metrics (text format) |
/healthz | Health check (HTTP 200 = OK) |
Prometheus Metrics
Policy Results
Tracks how many requests matched each rule and what action was taken:rule- Bot rule name from policy fileaction- Action taken: ALLOW, DENY, CHALLENGE, WEIGH
Available Metrics
Anubis exposes these metric families:Health Checks
HTTP Health Check
200 OK- Anubis is serving traffic500 Internal Server Error- Anubis is not ready424 Failed Dependency- Unknown health state
CLI Health Check
Anubis includes a built-in health check command:- 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
Top Rules
Challenge Success Rate
Requires application-level instrumentation (not built-in).Logging
Anubis uses structured logging (JSON format) with configurable levels.Log Levels
Log Sinks
Standard Error (Default)
File with Rotation
anubis.log.2026-03-03T12:00:00Z.gz
Structured Log Fields
rule- Matched rule nameaction- Action takenremote_addr- Client IPsubsystem- 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)
- 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
- 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
/healthzfor automated monitoring - Set reasonable timeout/retry values
- Monitor health check endpoint availability
- Set health check interval too low (< 10s)
- Use main application port for health checks
- Ignore health check failures
Troubleshooting
Metrics Not Scraped
Symptom: Prometheus showsup{job="anubis"} == 0
Check:
--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
Missing Metrics
Symptom: Noanubis_policy_results metrics
Cause: No traffic matching policy rules
Verify:
Next Steps
- Troubleshooting - Debug common issues
- Policy Configuration - Optimize rules for metrics
- Bot Rules - Track specific rule performance