11

I want to change the default timestamp format on rsyslog. Currently I am running on RHEL7.2. Syslog version 7.4.7. Now the default format is the following:

Mar 23 09:35:30 localhost DEB [9125:<console>.<module>:2] debug info 

Inside rsyslog.conf I have define the following template:

$template Mytemplate,"%timegenerated% %HOSTNAME% %syslogseverity-text:0:3:uppercase% %msg%\n" 

How can I change the format to this YYYY-MM-dd H:i:s ?

2 Answers 2

13

The modification is the following:

$template Mytemplate,"%$year%-%$month%-%$day% %timegenerated:12:19:date-rfc3339% %HOSTNAME% %syslogseverity-text:0:3:uppercase% %msg%\n" 
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for a clear and detailed question, and a specific usable answer!
2

%timegenerated:::date-pgsql% does exactly the job.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.