Skip to content

Allow for logfile naming like in Nomad #15709

@Esity

Description

@Esity

Feature Description

Currently consul logs files like this consul-{timestamp}.log
This is a pain to figure out the most recent log file. Sure we collect files and ship them out but sometimes it's useful to look inside /var/log

Nomad Example

ls -alh /var/log/nomad/
-rw-r-----.  1 root  root   51K Dec  6 01:50 nomad-1670313323123267918.log
-rw-r-----.  1 root  root   12K Dec  7 01:50 nomad-1670399732186160816.log
-rw-r-----.  1 root  root   16K Dec  7 09:55 nomad.log

But consul looks like this

ls -alh /var/log/consul/
drwxr-xr-x.  2 consul consul 4.0K Dec  7 08:34 .
drwxr-xr-x. 24 root   root   8.0K Dec  7 08:34 ..
-rw-r-----.  1 consul consul  39K Dec  1 11:35 consul-1669914326514455232.log
-rw-r-----.  1 consul consul 230K Dec  2 11:35 consul-1669916117380991503.log

Nomad Config Code
https://github.com/hashicorp/nomad/blob/1c9b4e398dd2b954dc0414b7c1568f04a3143355/command/agent/config.go#L66
https://github.com/hashicorp/nomad/blob/1c9b4e398dd2b954dc0414b7c1568f04a3143355/command/agent/config.go#L1326-L1328

Consul Config Code

LogFile *string `mapstructure:"log_file" json:"log_file,omitempty"`

Use Case(s)

The use here is to make this easier to tail the most recent log file

Metadata

Metadata

Assignees

No one assigned

    Labels

    theme/loggingRelating to logs and error messages

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions