Hi,

Our application sends syslog messages to a centralized facility which requires 
timestamps to be in microsecond format.
Our application was so far using log4j 1.12.5’s Syslog appender to send syslog 
messages, which used to format timestamps with microsecond precision.

We are now upgrading to log4j 2.17.0, and don’t see any way to get microseconds 
included in timestamp for syslog.

I am trying to log messages using SyslogAppender with RFC5424 layout.
I see that RFC5424Layout.java restricts timestamp to millisecond precision 
(e.g. 2021-12-22T22:54:33.889-08:00).

RFC5424 specification also mentions support for microsecond precision. Here is 
some text from https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.3

Example 4

         2003-08-24T05:14:15.000003-07:00

   This represents 24 August 2003 at 05:14:15am, 3 microseconds into the
   next second.  The microsecond resolution is indicated by the
   additional digits in TIME-SECFRAC.  The timestamp indicates that its
   local time is -7 hours from UTC.  This timestamp might be created in
   the US Pacific time zone during daylight savings time.


Is there a way to format timestamp with microsecond precision with 
RFC5424Layout? Or is there an alternative way to get timestamp formatted with 
microsecond precision for SyslogAppender?

Any help would be highly appreciated.

Thanks,
Atul Pendse

Reply via email to