[rsyslog] strftime() and timestamp do not work for me

Michelle Konzack linux4michelle at gmail.com
Fri Jan 27 16:02:40 CET 2017


Good day,

I have the need for a timestamp WITH the year and tried

----[ /etc/rsyslog.conf ]-----------------------------------------------

$template CustomDateTime, "%timegenerated:::date-strftime(%Y-%m-%d %H:%M:%S)% %HOSTNAME% %syslogtag%%msg%O\n"
$ActionFileDefaultTemplate CustomDateTime
------------------------------------------------------------------------

But I get the error message:

----[ /var/log/mail.log ]-----------------------------------------------

Jan 27 15:56:50Y-**INVALID PROPERTY NAME**m-**INVALID PROPERTY NAME**d **INVALID PROPERTY NAME**H:**INVALID PROPERTY NAME**M:**INVALID PROPERTY NAME**S)**INVALID PROPERTY NAME** mail courierd: Waiting.  shutdown time=none, wakeup time=Fri Jan 27 16:01:50 2017, queuedelivering=7, inprogress=1O

------------------------------------------------------------------------

What I want is to add the YEAR to the timestamp, mean:
changeing from

Jan 27 15:50:55 mail courieresmtpd:  started,ip=[::ffff:141.146.126.229]

to

Jan 27 2017 15:50:55 mail courieresmtpd:  started,ip=[::ffff:141.146.126.229]

How to do this?

Note:  This does not work either:

----[ /etc/rsyslog.conf ]-----------------------------------------------

$template CustomDateTime, "%timestamp:::date-year%-%timestamp:::date-month%-%timestamp:::date-day% %timestamp:::date-hour%:%timestamp:::date-minute%:%timestamp:::date-second% %HOSTNAME% %syslogtag% %msg%\n"
$ActionFileDefaultTemplate CustomDateTime
------------------------------------------------------------------------


Thanks in avance
Michelle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.adiscon.net/pipermail/rsyslog/attachments/20170127/5987a7dd/attachment.sig>


More information about the rsyslog mailing list