glossy icon indicating copy to clipboard operation
glossy copied to clipboard

fix: Pad milliseconds with three zeroes

Open bmaupin opened this issue 4 years ago • 1 comments

Hi!

Currently milliseconds are padded only with two zeroes, e.g.

<131>1 2021-09-27T15:52:35.35-07:00 localhost test-graylog-syslog 103065 - - error: Test message

Unfortunately Graylog parses 15:52:35.35 as 15:52:35.350 instead of 15:52:35.035, so this fixes that.

Also if this package could be published as a new version on NPM that would be great, since it would fix other issues such as #43 :grinning:

Thanks!

bmaupin avatar Sep 28 '21 14:09 bmaupin

I also just ran across this in the spec in case there's any doubt about this being a bug:

The TIMESTAMP described in Section 6.2.3 supports fractional seconds. This provides grounds for a very common coding error, where leading zeros are removed from the fractional seconds. For example, the TIMESTAMP "2003-10-11T22:13:14.003" may be erroneously written as "2003-10-11T22:13:14.3". This would indicate 300 milliseconds instead of the 3 milliseconds actually meant.

(https://datatracker.ietf.org/doc/html/rfc5424#appendix-A.4)

Thanks!

bmaupin avatar Sep 28 '21 16:09 bmaupin