I want to write my logs to /var/log/consul/consul_server.log and for that I've added this to my Consul configuration:
"log_level": "INFO",
"log_file": "/var/log/consul_server.log",
"enable_syslog": true,
After reloading Consul it's writing logs to the specified path however, it's not respecting the filename (consul_server.log) and it keeps adding a UNIX timestamp to my logs so my file looks like this: consul_server-1577827892114875204.log.
According to the documentation the log_file option is used _to redirect all the Consul agent log messages to a file. [...] In case the path doesn't have the filename, the filename defaults to consul-{timestamp}.log_ but I'm giving the path with the filename so a timestamp should not be added.
Server info
agent:
check_monitors = 0
check_ttls = 0
checks = 0
services = 0
build:
prerelease =
revision = 1200f25e
version = 1.6.2
consul:
acl = disabled
bootstrap = false
known_datacenters = 1
leader = false
leader_addr = 172.31.2.141:8300
server = true
raft:
applied_index = 18558
commit_index = 18558
fsm_pending = 0
last_contact = 38.393087ms
last_log_index = 18558
last_log_term = 4
last_snapshot_index = 16384
last_snapshot_term = 4
latest_configuration = [{Suffrage:Voter ID:c2d2e7bd-8c0e-1a2e-0db7-f38f524ea5a6 Address:172.31.31.106:8300} {Suffrage:Voter ID:f35b6204-33bc-e096-4363-e3736cfcc538 Address:172.31.2.141:8300} {Suffrage:Voter ID:60965527-9388-55b7-a823-0691f4d72160 Address:172.31.54.30:8300}]
latest_configuration_index = 1
num_peers = 2
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Follower
term = 4
runtime:
arch = amd64
cpu_count = 1
goroutines = 88
max_procs = 1
os = linux
version = go1.12.13
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 4
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 15
members = 6
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 15
members = 3
query_queue = 0
query_time = 1
OS: Amazon Linux 2 (Fully updated)
Architecture: x86_64
It seems is intended #4697
Can you check the rsyslog configuration file? maybe an entry was added for consul that is not following the format, also try to stop consul and delete all log files, then just touch the log file in /var/log/consul_server.log