Skip to content

Customisable Timestamp Format in Logs #2500

@mlladb

Description

@mlladb

Component(s)

No response

Is your feature request related to a problem? Please describe.

Across our six clusters we have more than 300 services, all of which emit logs using an ISO 8601 / RFC 3339 timestamp. Before these logs reach our centralised log store they go through a parsing and enrichment pipeline, and part of that process relies on timestamps being in that specific format.

Before I start modifying the enrichment logic to handle unix timestamps, I wanted to check whether it’s possible to configure the timestamp format when using structured logging with json_log.

From a quick look at the source, it appears the router uses Zap, which does support. I'm not a go engineer so I could be reading this wrong. However, I haven’t been able to find anything in the in the docs that explains how to configure this within the router.

Is there a way to override or configure the timestamp format?

Describe the solution you'd like

I'd like to be able to specify a time format in the configuration similar to how I specify log-level. A subset of standard time formats from strptime would be great.

access_logs:
  timestamp_format: iso_8601 # Default: unix_epoch

Describe alternatives you've considered

Parsing and modifying the logs before being sent to the centralised log system.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions