IBM Support

How to change the timezone for specific messages in rsyslog configuration

How To


Summary

If you have an rsyslog client and server in different timezones, and you would like the rsyslog server to record a log message using the time on the rsyslog client, then you will need to modify the client-side rsyslog templates.

Steps

  • remote syslog configuration is out of scope of this document.
  • Make sure the client can send messages to the rsyslog server first, before changing any further configurations
    • On the rsyslog server, tail the log file:
       
      ​​​​​​​# tail -fn0 /path/to/log
    • You can use a command like logger to validate the rsyslog configuration (change the facility and priority to match your configuration):
      # logger -p local4.debug 'the time now is '`date`
  • Once confirmed, you can use rsyslog templates for the configuration. Here is an example taken from the /etc/rsyslog.conf on the client side
$template myFormat,"%timereported% %HOSTNAME% %syslogtag%%msg%\n"
$ActionFileDefaultTemplate myFormat
local4.debug				@1.2.3.4;myFormat
  • If you use the same logger command, the new messages should be recorded according to the timezone set on the client.

Document Location

Worldwide

[{"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SGMV168","label":"SUSE Linux Enterprise Server"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)","Line of Business":{"code":"LOB68","label":"Power HW"}}]

Document Information

Modified date:
05 August 2024

UID

ibm16257137