首页 > 解决方案 > 如何在 syslog 中禁用 logstash 错误日志记录

问题描述

所有 Logstash 错误都记录在 /var/log/logstash/* 中,但 Logstash 的所有错误日志也记录在 /var/log/syslog 中。有什么方法可以在 /var/log/syslog 中禁用 Logstash 的日志记录错误?

标签: logstashsyslogrsyslog

解决方案


另一种解决方案是修改/etc/systemd/system/logstash.service和更改这两个选项,如下所示

StandardOutput=null
StandardError=null
# cat /etc/systemd/system/logstash.service
[Unit]
Description=logstash

[Service]
Type=simple
User=logstash
Group=logstash
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/logstash
EnvironmentFile=-/etc/sysconfig/logstash
ExecStart=/usr/share/logstash/bin/logstash "--path.settings" "/etc/logstash"
StandardOutput=null
StandardError=null
Restart=always
WorkingDirectory=/
Nice=19
LimitNOFILE=16384

# When stopping, how long to wait before giving up and sending SIGKILL?
# Keep in mind that SIGKILL on a process can cause data loss.
TimeoutStopSec=infinity

[Install]
WantedBy=multi-user.target

那么当然

#systemctl daemon-reload
#systemctl restart logstash

推荐阅读