p0pr0ck5 / lua-resty-waf

High-performance WAF built on the OpenResty stack
GNU General Public License v3.0
1.28k stars 305 forks source link

ISO 8601 timestamp format #315

Closed kariedo closed 5 years ago

kariedo commented 5 years ago

Any ideas how can I change the log timestamp format from unix timestamp to ISO 8601 one? I.e. I would like to get:

{"timestamp":"2019-02-07T21:02:38Z",

instead of:

{"timestamp":1549573358,

Thanks!

kariedo commented 5 years ago

I've been able to bypass the problem by adding timestamps on the rsyslog side, i.e. don't rely on the timestamp in the JSON payload, closing the issue.

template(name="LogFormat" type="string"
string="<%pri%>%protocol-version% %timestamp:::date-rfc3339% %HOSTNAME% %app-name% %procid% %msgid% %msg%\n"
)