Consul: -log-file flag always appends a timestamp to log file names

Created on 20 Sep 2018  路  5Comments  路  Source: hashicorp/consul

No matter what log file name I pass Consul always just creates log files named -timestamp.log

example:

/usr/local/bin/consul agent -config-dir /etc/consul -log-file='/var/log/consul/consul.log'

generates:

/var/log/consul# ls
consul-1537395014138763084.log

and
/usr/local/bin/consul agent -config-dir /etc/consul -log-file='/var/log/consul/consultest.log'

generates:

consultest-1537398275310124337.log

Is it intentional that a timestamp is always appended to our logs? This is not clear in the documentation as it states 'In case the path doesn't have the filename, the filename defaults to Consul-timestamp.log . '

typdocs

Most helpful comment

Hi @MagnumOpus21 , is it possibly to set log name without timestamp?

All 5 comments

Hey @pdroz . This is indeed the behavior for the log files. The filename you provide gets the timestamp appended to. If you don't give a filename, the default filename would be Consul. And this gets the timestamp added at the end of a write/ create file operation. Hope this resolves your confusion.

I made a small PR to clarify the format of this file. Thanks!

Hi @MagnumOpus21 , is it possibly to set log name without timestamp?

Why on earth would you decide for user the log file name format? They can use logrotate to rotate the logs in whatever way they wish and use syslog along with logging daemon to spit custom filenames.

Hey there,

This issue has been automatically locked because it is closed and there hasn't been any activity for at least _30_ days.

If you are still experiencing problems, or still have questions, feel free to open a new one :+1:.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wargamez picture wargamez  路  4Comments

matteoturra picture matteoturra  路  4Comments

satheeshCharles picture satheeshCharles  路  3Comments

powerman picture powerman  路  3Comments

darron picture darron  路  4Comments