Metrics
Overview
coreX Platform provides real-time metrics dashboards for HAProxy, WAF, and cache subsystems. All metrics are sampled periodically and stored in the database for historical analysis.
HAProxy Metrics
HAProxy process info and stats are sampled every 30 seconds and stored in MetricSnapshot records.
Configuration
| Setting | Default | Description |
|---|---|---|
METRICS_SAMPLE_INTERVAL_SECONDS | 30 | How often to sample metrics |
METRICS_RETENTION_DAYS | 30 | How long to retain metric data |
HAPROXY_MAXCONN | 4096 | HAProxy max connections |
API
GET /metrics?from=<timestamp>&to=<timestamp>&step=<seconds>
Frontend
The metrics dashboard renders:
- Recharts line and area charts for traffic, connections, and response times
- Server status table with up/down state and connection counts
- Time range selector (1h, 6h, 24h, 7d, custom)
WAF Metrics
WAF events are logged by Coraza SPOA and sampled into the WafMetric table.
Configuration
| Setting | Default | Description |
|---|---|---|
CORAZA_SPOA_LOG_PATH | /app/data/coraza-spoa.log | Path to the Coraza SPOA log |
WAF_METRICS_SAMPLE_INTERVAL_SECONDS | 30 | How often to sample WAF events |
WAF_METRICS_RETENTION_DAYS | 30 | How long to retain WAF metric data |
API
GET /waf/metrics?from=<timestamp>&to=<timestamp>&step=<seconds>&breakdown=<field>
Breakdowns: action, rule_id, severity, msg
Frontend
The WAF metrics panel shows:
- Stacked bar chart of WAF events over time
- Totals table with counts per breakdown category
- Dropdown to switch between breakdown dimensions
Cache Metrics
Cache metrics are sampled every 30 seconds:
- Hit rate
- Number of cached objects
- Total bytes cached
API
GET /cache/metrics?from=<timestamp>&to=<timestamp>&step=<seconds>
Step-by-Step: View the Metrics Dashboard
- Navigate to Observability > Metrics
- Select a time range (1h, 6h, 24h, 7d, or custom)
- View the HAProxy metrics charts:
- Requests per second
- Active connections
- Response time percentiles
- Server status table
- Switch to the WAF tab to view WAF event metrics
- Switch to the Cache tab to view cache hit rates
Verification
-
Check metrics are being sampled:
curl -k https://localhost/api/metrics?step=30 | python3 -m json.tool | headExpect JSON with recent metric data.
-
Check WAF metrics:
curl -k "https://localhost/api/waf/metrics?breakdown=action" | python3 -m json.tool | head -
Generate test traffic and check metrics:
for i in $(seq 1 100); do curl -k -s -o /dev/null https://localhost/; doneThen re-check the metrics dashboard to see the traffic reflected in the charts.
Next Steps
- Log Pipeline — Forward logs to external destinations (S3, Datadog, Splunk, etc.)
- Audit & Snapshots — Track config changes and revert
- WAF — Configure WAF rules that generate WAF events
- Risk Scoring — Score requests and view scores in logs