vmware / fluent-plugin-vmware-loginsight

Fluentd plugin to forward logs to VMware Aria Operations for Logs
Other
10 stars 13 forks source link

correctly handle fractions of seconds in timestamps #33

Closed twi010 closed 11 months ago

twi010 commented 11 months ago

Fixes #32 in which timestamps sent to log insight always get rounded down to the closest full second, losing the millisecond information. A timestamp like this "2021-08-13T14:41:21.898738172+00:00" gets converted to a Unix timestamp of 1628865681000. The correct value would be 1628865681898.

This patch keeps the milliseconds information by converting the time variable (a Fluent EventTime object) to a floating point variable before it is multiplied by 1000 so that the millisecond information is not lost. It then rounds it down to a full long integer to get a valid Unix timestamp.

vmwclabot commented 11 months ago

@twi010, you must sign every commit in this pull request acknowledging our Developer Certificate of Origin before your changes are merged. This can be done by adding Signed-off-by: John Doe <john.doe@email.org> to the last line of each Git commit message. The e-mail address used to sign must match the e-mail address of the Git author. Click here to view the Developer Certificate of Origin agreement.