Rsyslog on Ubuntu 14.04 – Configure to Use ISO8601 Timestamps

rsyslogsyslogUbuntu

In a file in /etc/rsyslog.d/ I have the following:

local3.*        /var/log/mylog.log

When I log to this facility, records have timestamps which look like this:

Apr 27 21:12:20 hostname msg

How do I set things up so that they look like this instead?

2014-04-27T21:12:20 hostname msg

Best Answer

This can be achieved by commenting out the following line in /etc/rsyslog.conf as the comment suggests:

#
# Use traditional timestamp format.
# To enable high precision timestamps, comment out the following line.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

Log format now looks like this:

2014-04-29T20:41:36.366613+01:00 hostname msg