Health Checks
The proxy listens on the port defined by thePORT environment variable (default: 8081). You can verify the proxy is running:
Key Metrics to Monitor
Connection Metrics
Active Connections- Monitor concurrent connections to detect traffic spikes
- High connection counts may indicate DDoS attempts
- See main.go:424-596 for request handling flow
- Track successful vs. failed backend connections
- Monitor for “Bad Gateway” errors (HTTP 502)
- Backend failures are logged with:
Bad Gateway: <error>(main.go:563)
Security Metrics
WAF Blocks Monitor these block events in your application logs:- Sudden spikes may indicate an attack
- Consistent blocks from specific IPs warrant investigation
- Identify abusive clients
- Tune rate limits (see
PROXY_RATE_LIMITandPROXY_RATE_BURSTenvironment variables) - Default: 5 requests/second with burst of 10 (main.go:412-415)
GEO_BLOCK_ENABLED=true, monitor:
PROXY_BLOCK_BOTS=true, monitor:
Performance Indicators
Response Times Monitor end-to-end latency including:- WAF inspection time
- Backend response time
- Network overhead
- IP rate limiters (cleaned up after 3 minutes of inactivity - main.go:89)
- WAF transaction processing
- Request/response buffering
- WAF rule complexity (PL1 vs PL2 paranoia levels)
- Request body inspection
- High request rates
Log Files to Monitor
See the Logging page for detailed information about log files and their locations.Application Logs (stdout)
Key startup messages:Audit Logs
Location:/tmp/log/coraza/audit.log
Contains WAF transaction details in JSON format (SecAuditLogFormat JSON). Monitor this file for:
- Detailed attack patterns
- Rule matches and scores
- Full request/response data for blocked requests
Debug Logs
Location:/tmp/log/coraza/debug.log
By default, debug logging is disabled (SecDebugLogLevel 0). Enable for troubleshooting by setting SecDebugLogLevel to 1-9 in your Coraza configuration.
Monitoring Best Practices
Alert Thresholds
Recommended alerts:- High WAF block rate: >10% of requests blocked
- Backend failures: >5% error rate
- Rate limit hits: Same IP hitting limits repeatedly
- Memory growth: Sustained memory increase over time
- GeoIP lookup failures:
geo lookup failedmessages
Log Aggregation
Consider shipping logs to a centralized system:- Parse JSON audit logs for structured analysis
- Correlate WAF blocks with backend errors
- Create dashboards for security metrics
- Set up alerting on anomalous patterns
Metrics Collection
Integrate with monitoring tools:- Export custom metrics from application logs
- Track request counts by host, status code, and block reason
- Monitor rate limiter state and cleanup cycles
- Graph backend selection and round-robin distribution
Performance Tuning
Based on monitoring data, tune these parameters:- Rate limits: Adjust
PROXY_RATE_LIMITandPROXY_RATE_BURST - Body limits: Modify
SecRequestBodyLimit(default: 13107200 bytes) - Paranoia level: Balance security vs. performance (PL1 vs PL2)
- Backend configuration: Optimize backend pool size and health checks
Health Check Endpoints
The proxy doesn’t expose dedicated health endpoints. Monitor health by:- Process health: Ensure the process is running
- Port availability: Verify the configured PORT is listening
- Backend connectivity: Test end-to-end requests
- Log activity: Check for recent log entries
- WAF initialization: Verify startup messages in logs
