Description
The event structure of Fluentd consists of the following:
- Tag
- Time (Epoch time)
- record (Actual log content - JSON format)
When fluentd event is received and decoded, the Time
(epoch time) is used as timestamp when creating the Logstash event which sets the time for the event. Since the Time
is an epoch time, milliseconds can't be set. Even if there is a field in the actual log content called @timestamp
, it gets overwritten.
In our case, we set the @timestamp
value in the record with a precision grater than epoch time and we do not wish this to be overwritten.
Here is the code setting @timestamp
in the plugin
- https://github.com/logstash-plugins/logstash-codec-fluent/blob/master/lib/logstash/codecs/fluent.rb#L88
- https://github.com/logstash-plugins/logstash-codec-fluent/blob/master/lib/logstash/codecs/fluent.rb#L99
- https://github.com/logstash-plugins/logstash-codec-fluent/blob/master/lib/logstash/codecs/fluent.rb#L109
Can we have an option to NOT use the Time
to set the Logstash event time and let logstash use the @timestamp
field instead if present in actual log?
This way we're not just limited to seconds and can have time in finer precision