Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable_syslog=false does nothing. #20825

Open
EugenKon opened this issue Mar 11, 2024 · 3 comments
Open

enable_syslog=false does nothing. #20825

EugenKon opened this issue Mar 11, 2024 · 3 comments

Comments

@EugenKon
Copy link

I turned off logging via syslog, but it still logs via it

https://developer.hashicorp.com/consul/docs/agent/config/config-files#enable_syslog

It is not clear how to reconfigure logging via files.

config file
$ cat /etc/consul.d/consul.hcl
# https://developer.hashicorp.com/consul/docs/agent#configuring-consul-agents
datacenter = "dc1"

data_dir = "/opt/consul/data"
server = true                               # Agent mode
bootstrap_expect = SERVER_COUNT             # Ignored in client mode
retry_join = ["RETRY_JOIN"]                 # The default value comes from `aws/variables.tf` file

# DNS
domain = "prd.plntr.ca"
# recursors = [ "8.8.8.8" ]
client_addr = "0.0.0.0"

# addresses = { }
bind_addr = "0.0.0.0"
advertise_addr = "IP_ADDRESS"

acl {
    enabled = false
    default_policy = "allow"
    down_policy = "extend-cache"
}

# Logging
# https://developer.hashicorp.com/consul/commands/monitor
enable_debug = true
log_level = "trace"
enable_syslog = false
log_rotate_max_files = 30
log_rotate_duration = "24h"

ui_config {
  enabled = true
}

# server_name =
tls {
  defaults {
    tls_min_version = "TLSv1_3"
    # TODO: Improve the SECURITY
  }
}

# TODO: Improve the SECURITY
# grpc =
# https =
# internal_rpc =

ports {
  dns = 8600
  grpc = 8502
  # TODO: !SECURITY
  # https://developer.hashicorp.com/consul/docs/agent/config/config-files#grpc_tls_port
  # grpc_tls = 8503
  # http  = -1
  # https = 8501
}

# Service Mesh related
# https://developer.hashicorp.com/consul/docs/connect/configuration#agent-configuration
connect {
  enabled = true
  # TODO: Improve the SECURITY
  # ca_provider =
}

service {
  name    = "consul"
}

$ cat /etc/systemd/system/consul.service
[Unit]
Description=Consul Agent
Requires=network-online.target
After=network-online.target

[Service]
Restart=on-failure
Environment=CONSUL_ALLOW_PRIVILEGED_PORTS=true
ExecStart=/usr/local/bin/consul agent -config-dir="/etc/consul.d" -dns-port="8600"
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGTERM
User=root
Group=root

[Install]
WantedBy=multi-user.target
@dilinares
Copy link

dilinares commented Jul 10, 2024

Same issue as above, setting enable_syslog = false is ignored, and Consul logs are forwarded to syslog. I'm running 1.16.3

consul.hcl

datacenter = "dc"
data_dir = "/opt/consul"
encrypt = "..."

ui_config{
  enabled = true
}

log_level = "INFO"
log_file = "/var/log/consul/consul.log"
log_rotate_max_files = 30
enable_syslog = false

server = true
bind_addr = "0.0.0.0"
client_addr = "127.0.0.1"
advertise_addr = "192.168.1.2"
node_name = "consul-02"
bootstrap_expect = 3
retry_join = ["192.168.1.2:8301","192.168.1.3:8301","192.168.1.4:8301"]

acl {
  enabled = true
  default_policy = "deny"
  enable_token_persistence = true
}

consul.service

[Unit]
Description="HashiCorp Consul - A service mesh solution"
Documentation=https://www.consul.io/
Requires=network-online.target
After=network-online.target
ConditionFileNotEmpty=/etc/consul.d/consul.hcl

[Service]
User=consul
Group=consul
ExecStart=/usr/local/bin/consul agent -config-dir=/etc/consul.d/
ExecReload=/usr/local/bin/consul reload
KillMode=process
KillSignal=SIGTERM
Restart=on-failure
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

@n1nj444
Copy link

n1nj444 commented Jan 8, 2025

Hello people, any news from this ?

@approximate
Copy link

Is it syslog (i.e. rsyslog) or system journal (on systemd-controlled OS)? If latter, please consider disabling stdout/stderr for the Consul service (see this support forum post for more details). In the former case, you can suppress all messages from Consul using this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants