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

SettingDefaultDescription
METRICS_SAMPLE_INTERVAL_SECONDS30How often to sample metrics
METRICS_RETENTION_DAYS30How long to retain metric data
HAPROXY_MAXCONN4096HAProxy 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

SettingDefaultDescription
CORAZA_SPOA_LOG_PATH/app/data/coraza-spoa.logPath to the Coraza SPOA log
WAF_METRICS_SAMPLE_INTERVAL_SECONDS30How often to sample WAF events
WAF_METRICS_RETENTION_DAYS30How 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

  1. Navigate to Observability > Metrics
  2. Select a time range (1h, 6h, 24h, 7d, or custom)
  3. View the HAProxy metrics charts:
    • Requests per second
    • Active connections
    • Response time percentiles
    • Server status table
  4. Switch to the WAF tab to view WAF event metrics
  5. Switch to the Cache tab to view cache hit rates

Verification

  1. Check metrics are being sampled:

    curl -k https://localhost/api/metrics?step=30 | python3 -m json.tool | head

    Expect JSON with recent metric data.

  2. Check WAF metrics:

    curl -k "https://localhost/api/waf/metrics?breakdown=action" | python3 -m json.tool | head
  3. Generate test traffic and check metrics:

    for i in $(seq 1 100); do curl -k -s -o /dev/null https://localhost/; done

    Then 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