vim /etc/systemd/system/filebeat.service
[Unit]
Description=Filebeat Service
Documentation=https://wszf.me
After=network-online.target
Wants=network-online.target

[Service]
Type=notify
User=USER
ExecStart=#可执行路径
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
StandOutput=syslog
StandError=inherit

[Install]
WantedBy=multi-user.target
Alias=filebeat.service
#更新service
systemctl daemon-reload
#启动服务
systemctl start filebeat.service
#设置开机自动启动
systemctl enable filebeat.service
#查看日志
journalctl -n 50 -u filebeat