filebeat 进程莫名消失

问题描述

版本信息:filebeat-7.7.0-linux-x86_64.tar.gz
启动方式:nohup ./filebeat -c filebeat.yml >/dev/null 2>&1 &
导致问题:运行一段时候后自动关闭。大概就是 很久没有拉取到日志

解决方案

用system管理

cat > /usr/lib/systemd/system/filebeat.service <<EOF
[Unit]
Description=Filebeat is a lightweight shipper for metrics.
Documentation=https://www.elastic.co/products/beats/filebeat
Wants=network-online.target
After=network-online.target

[Service]
Environment="LOG_OPTS=-e"
Environment="CONFIG_OPTS=-c /usr/local/filebeat/filebeat.yml"
Environment="PATH_OPTS=-path.home /usr/local/filebeat -path.config /usr/local/filebeat -path.data /usr/local/filebeat/data -path.logs /usr/local/filebeat/logs"
ExecStart=/usr/local/filebeat/filebeat $LOG_OPTS $CONFIG_OPTS $PATH_OPTS
Restart=always

[Install]
WantedBy=multi-user.target
EOF

chmod +x /usr/lib/systemd/system/filebeat.service
systemctl daemon-reload
systemctl enable filebeat --now

注意修稿配置,日志,数据存放的目录

posted @ 2021-11-17 23:03  zuozhengjun  阅读(344)  评论(0编辑  收藏  举报