My syslog configuration (the default CentOS 5.3 configuration) writes out time stamps that look like

Jan  1 00:00:00 message

I would like the timestamp to contain the year. Preferably it would look like

2010-01-01 00:00:00.000000 message

Is there any way to configure syslog to do this?


CentOS 5.4 uses sysklogd by default, syslog-ng is not provided*.There is no mention of how to alter the date format in the syslog.conf manpage. rsyslog is available through the default repositories and, glancing at its manpage, it may do what you want.

*See Where can I find syslog-ng in Red Hat Enterprise Linux 5?

  • Hmm, it looks like this is the path I will have to go down. We don't have enough time to drop in rsyslog now, but I think it will work well for version 2.0. – Chas. Owens Jan 15 '10 at 2:39

What version of syslog does CentOS use?

Syslog-NG will let you change the template to use $FULLDATE or $ISODATE which seems to do what you want.

Syslog-ng Mailing List documenting templates

  • An ISO date is pretty much what I am looking for. The version reported by syslogd -v is syslogd 1.4.1. – Chas. Owens Jan 15 '10 at 0:33
  • 1
    +1 for using syslog-ng over syslogd, much more powerful and flexible. – Mike Pountney Jan 15 '10 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.