syslog-ng: add receive timestamps to nginx logs

Since nginx only uses 1 second precision for the error logs and syslog
timestamps, we can use receive time on the syslog-ng side. We can switch
to source time once nginx adds RFC 5424 support which is currently in an
open pull request but will likely require changes to add a configuration
option for it. Our approach to working around this within nginx doesn't
work perfectly since $msec generates the time on-demand separately from
the timestamp used by $time_iso8601.
This commit is contained in:
Daniel Micay 2025-11-08 14:43:41 -05:00
parent a45b8ada72
commit b80f10f396

View file

@ -6,10 +6,10 @@ source s_nginx_error {
};
destination d_nginx_access {
file("/var/log/nginx/access.log" template("${MESSAGE}\n"));
file("/var/log/nginx/access.log" template("${R_ISODATE} ${MESSAGE}\n"));
};
destination d_nginx_error {
file("/var/log/nginx/error.log" template("${MESSAGE}\n"));
file("/var/log/nginx/error.log" template("${R_ISODATE} ${MESSAGE}\n"));
};
log {