segmentio / ecs-logs

Log forwarder for services ran by ecs-agent.
MIT License
114 stars 16 forks source link

Timestamp #6

Closed achille-roussel closed 8 years ago

achille-roussel commented 8 years ago

@segmentio/infra

The default JSON encoder doesn't omit fields tagged with omitempty if they are not base types, time.Time is a struct so it was getting serialized to CloudWatchLogs which is redundant with the Timestamp field.

I replaced the use of time.Time in the ecslogs.Message.Time field with a ecslogs.Timestamp type which represents a microsecond precision timestamp and can be set to zero so it doesn't get serialized in the CloudWatchLogs events.

Please take a look and let me know if this is good to go!