Log File Locations
The proxy creates log files during startup (main.go:344-368):Audit Log
Path:/tmp/log/coraza/audit.logPermissions:
0644Format: JSON Created automatically on startup:
coraza.conf:
Debug Log
Path:/tmp/log/coraza/debug.logPermissions:
0644
Created automatically on startup:
SecDebugLogLevel 0 in coraza.conf).
Application Log
Output: stdout/stderrFormat: Plain text Standard Go logging via the
log package. All operational messages, errors, and informational logs are written to standard output.
Log Directory Structure
/tmp/log/coraza is created with permissions 0755 during proxy startup.
Audit Log Format
Configuration
SecAuditLogFormat JSON: Structured JSON output for parsing
SecAuditLogParts ABIJDEFHZ: Includes specific transaction parts
Audit Log Parts
- A: Audit log header (mandatory)
- B: Request headers
- I: Request body (POST payload)
- J: Additional information
- D: Reserved for intermediary response headers
- E: Intermediary response body
- F: Final response headers
- H: Audit trailer (includes rule matches)
- Z: Final boundary
Example Audit Entry
Application Log Messages
Startup Messages
Request Processing
Configuration Errors
PORT environment variable is invalid (main.go:183).
Security Events
WAF Blocks:Backend Errors
Transaction Errors
Debug Logging
Enabling Debug Logs
Modify your Coraza configuration file to enable debug logging:- 0: No debug logging (default)
- 1: Errors only
- 2: Warnings
- 3: Notices (recommended for troubleshooting)
- 4: Info
- 5-9: Increasingly verbose debug output
Warning
Debug logging significantly impacts performance. Only enable when troubleshooting specific issues. Always set back to0 in production.
Log Rotation
The proxy does not implement built-in log rotation. Implement external log rotation using:Using logrotate (Linux)
Create/etc/logrotate.d/coraza-proxy:
Using Docker Logging Drivers
If running in Docker, configure logging drivers:Log Parsing and Analysis
Parse JSON Audit Logs
Usingjq to analyze audit logs:
Parse Application Logs
Centralized Logging
Shipping to ELK Stack
Filebeat configuration for shipping logs:Shipping to Splunk
Performance Considerations
- Audit logging:
RelevantOnlymode reduces log volume significantly - Debug logging: Disable in production (SecDebugLogLevel 0)
- Log location:
/tmpis in-memory on many systems; consider persistent storage - JSON parsing: Structured logs enable efficient querying but may increase write overhead
- Log rotation: Prevents disk exhaustion in high-traffic environments
