owasp-modsecurity / owasp-modsecurity/ModSecurity

Timezone is not included in the time_stamp field of audit log in JSON format

Open
#2,340 12 comments 0 reactions 1 assignee View on GitHub

@martinhsv is already working on this.

Since Jun 17, 2020.

3.x enhancement workaround available
Dominant language
C++
Stars
9.8k
Forks
1.8k
Avg merge
2h 46m
Merged PRs (30d)
1

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

  1. Configure SecAuditLogFormat to JSON
  2. Make sure 'A' section is enabled in SecAuditLogFormat parameter. Ex.: SecAuditLogParts ABJFHZ
  3. Restart nginx to apply new settings
  4. Perform any request to the web server that would get a new record put into audit log
  5. Check the audit log, specifically time_stamp field in the latest record

Expected behavior

  • Either timezone is specified in time_stamp field when SecAuditLogFormat is set to JSON
  • 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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.