-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Date format is getting changed after converting syslog object to toRfc5424SyslogMessage #36
Comments
Hi , Any update on above query? |
Date formatting in the syslog-java-clientDates are formatted according to the RFC 5424 (and RFC 3339) hard coding the locale to new ConcurrentDateFormat(
"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'",
Locale.US,
TimeZone.getTimeZone("GMT"),
concurrency); SpecificationsRFC 5424 - The Syslog Protocolhttps://tools.ietf.org/html/rfc5424#section-6.2.3
RFC 3339 Date and Time on the Internet: Timestampshttps://tools.ietf.org/html/rfc3339#section-5.6
|
@arjunpidugu642 you are asking to use another timezone in the syslog timestamp than the Would it make sense to use the time zone of the server on which the java-syslog-client runs? https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getDefault--
|
As per RFC 5424 and RFC 3339, We need to follow timestamp with respect to time zone which we can achieve using Coordinated Universal Time(UTC). But as per your code |
From what I remember, I picked |
Thanks a lot for your response. I require below timestamp format " yyyy-MM-dd'T'HH:mm:ss.SSSXXX" |
what would be the date format for your case? ->[My Answer] " yyyy-MM-dd'T'HH:mm:ss.SSSXXX" Please find below examples as per RFC 3339: """1985-04-12T23:20:50.52Z -> This represents 20 minutes and 50.52 seconds after the 23rd hour of So, According to RFC3339. 1996-12-19T16:39:57-08:00( "yyyy-MM-dd'T'HH:mm:ss.SSSXXX") is equavalent to 1996-12-20T00:39:57Z("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") and both are valid date formats. My requirement is to send syslog message in below date format -> "yyyy-MM-dd'T'HH:mm:ss.SSSXXX". Please help me on this. |
Can you please help me on this. |
I have started to introduce more configurability for the time format and timezone, I need to adapt the unit tests as well. |
Thanks @cyrille-leclerc . |
Hi,
Require date as below format in my Syslog message
"2019-07-18T18:56:38.001+05:30"
Setting date using below API.
syslogMessage.setTimestamp
But After converting syslogMessage object to toRfc5424SyslogMessage and my format of date is changed as below.
"2019-07-18T13:26:38.001Z".
Is there any way to achieve my requirement?
is it possible to provide setTimestamp(String date) API which accepts string instead of Date object?
The text was updated successfully, but these errors were encountered: