Description
Description
Timezone is not included in the time_stamp
field of audit log if SecAuditLogFormat
is set to JSON
If SecAuditLogFormat
is set to Native
, the time and date are written to audit log like following:
---immbqR4e---A--
[16/Jun/2020:11:24:03 +0300]
Keeping all other setting the same, but setting SecAuditLogFormat
to JSON
, the time and date are written to audit log like following:
"time_stamp":"Tue Jun 16 11:24:03 2020"
Note that it's not UTC time, it's local time on the server.
Steps to reproduce the behavior
- Configure
SecAuditLogFormat
toJSON
- Make sure 'A' section is enabled in
SecAuditLogFormat
parameter. Ex.:SecAuditLogParts ABJFHZ
- Restart nginx to apply new settings
- Perform any request to the web server that would get a new record put into audit log
- Check the audit log, specifically
time_stamp
field in the latest record
Expected behavior
- Either timezone is specified in
time_stamp
field whenSecAuditLogFormat
is set toJSON
- Or
time_stamp
always contains UTC time and not local time - Or there's an option to set up
time_stamp
format in configuration file (which I couldn't find)
Rationale
Imagine modsecurity audit logs are shipped to ELK or other log management system from multiple servers, including those located in regions with with daylight saving time. Then there's no common way to correctly parse the time_stamp
field given that different servers might be in different timezone and also timezone is not persistent for some of them.
Server
- ModSecurity v3.0.4 with nginx-connector v1.0.1
- WebServer: ngingx-1.18.0-1~bionic
- OS: Ubuntu 18.04.4