# 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
3条答案
按热度按时间t8e9dugd1#
我假设你从systemd运行logstash。由于未知原因,logstash打印它的日志在stdout/stderr上,所以journald将控制台输出转发到syslog。重定向systemd单元文件中的stdout/err,如下所示:
然后
和
yjghlzjz2#
另一种解决方案是修改
/etc/systemd/system/logstash.service
并将这两个选项更改为如下所示那么当然
wn9m85ua3#
打开/etc/logstash/log4j2.properties并注解掉此行