Consul: Include timezone in log output

Created on 1 Aug 2016  路  6Comments  路  Source: hashicorp/consul

Currently Consul logs (written to /var/log/upstart/consul.log at least for us) do not contain the timezone. This makes it difficult to accurately ingest the logs into a logging pipeline such as Logstash.

typenhancement

Most helpful comment

In my opinion, better to follow a well known standard
https://en.wikipedia.org/wiki/ISO_8601

would be much easier to parse.

All 6 comments

Oops, I meant timezone not timestamp.

@slackpad @joshuaspence I can tackle this. What should the format be for adding the timezone?

Currently a timestamp in the log looks like this:
2016/10/26 09:28:13 [INFO]

Should the timezone simply follow the time?
2016/10/26 09:28:13 PST [INFO] for example

In my opinion, better to follow a well known standard
https://en.wikipedia.org/wiki/ISO_8601

would be much easier to parse.

@rom-stratoscale I agree, standards all always nice. However, the Log package doesn't support that standard for some reason. There is an option to use UTC time instead but that's about it.

Closing this against https://github.com/hashicorp/consul/issues/1249, which will hopefully allow this to be customized.

To format the date, this seems to work without using any fancy packages:
https://play.golang.org/p/RC9JxV_LaA

I'm not quite sure where I can use that snippet within Consul though. Seem to be a simple change but I don't know about how to integrate with the consul codebase.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deadjoe picture deadjoe  路  4Comments

philsttr picture philsttr  路  3Comments

nicholasjackson picture nicholasjackson  路  3Comments

powerman picture powerman  路  3Comments

satheeshCharles picture satheeshCharles  路  3Comments