Im trying to change the IETF timestamp format (number of precision). I have used to_syslog_ietf to create the formatted log message. Is anyone know how can we change the time from 6 decimal to 3 or no decimal precision)?

Sample Logs - (Current timestamp with 6 decimal)
2012-01-01T17:15:52.873750+08:00 myhost - - - [NXLOG@14506 TestField="test value"] test message

Required (timestamp with 3 decimal or no decimal)
2012-01-01T17:15:52.000+08:00 myhost - - - [NXLOG@14506 TestField="test value"] test message


AskedApril 29, 2020 - 11:25am

Answer (1)


You should try built-in functions strftime or strptime, described here: https://nxlog.co/docs/nxlog-ce/nxlog-reference-manual.html#core_funcs
They both are about to convert in some time format but there some more details.

Hope it helps.
Regards, Arch