Filebeat自动关闭问题解决

问题描述

版本信息:filebeat-7.7.0-linux-x86_64.tar.gz
启动方式:nohup ./filebeat -c filebeat.yml &
导致问题:运行一段时候后自动关闭,日志如下

2020-05-26T07:20:52.806+0800    INFO    beater/filebeat.go:449  Stopping filebeat
2020-05-26T07:20:52.806+0800    INFO    beater/crawler.go:138   Stopping Crawler
2020-05-26T07:20:52.806+0800    INFO    beater/crawler.go:148   Stopping 1 inputs
2020-05-26T07:20:52.806+0800    INFO    cfgfile/reload.go:238   Dynamic config reloader stopped
2020-05-26T07:20:52.806+0800    INFO    input/input.go:149  input ticker stopped
2020-05-26T07:20:52.806+0800    INFO    input/input.go:167  Stopping Input: 4779968662065981764
2020-05-26T07:20:52.806+0800    INFO    harvester/forwarder.go:52   Input outlet closed
2020-05-26T07:20:52.806+0800    INFO    log/harvester.go:320    Reader was closed: /home/yezhou/applogs/eureka-server.log. Closing.
2020-05-26T07:20:52.806+0800    INFO    beater/crawler.go:164   Crawler stopped
2020-05-26T07:20:52.806+0800    INFO    registrar/registrar.go:367  Stopping Registrar
2020-05-26T07:20:52.806+0800    INFO    registrar/registrar.go:293  Ending Registrar
2020-05-26T07:20:52.835+0800    INFO    [monitoring]    log/log.go:153  Total non-zero metrics  {"monitoring": {"metrics": {"beat":{"cpu":{"system":{"ticks":27060,"time":{"ms":27060}},"total":{"ticks":54630,"time":{"ms":54631},"value":54630},"user":{"ticks":27570,"time":{"ms":27571}}},"handles":{"limit":{"hard":100002,"soft":100001},"open":12},"info":{"ephemeral_id":"73be5fc1-5dff-4739-8e53-3c3fe50f3fef","uptime":{"ms":30851737}},"memstats":{"gc_next":12299920,"memory_alloc":7304424,"memory_total":8235809224,"rss":42262528},"runtime":{"goroutines":24}},"filebeat":{"events":{"added":23527,"done":23527},"harvester":{"closed":4,"open_files":0,"running":0,"started":4}},"libbeat":{"config":{"module":{"running":0},"reloads":1,"scans":1},"output":{"events":{"acked":23515,"batches":7054,"total":23515},"type":"kafka"},"outputs":{"kafka":{"bytes_read":385840,"bytes_write":6362352}},"pipeline":{"clients":0,"events":{"active":0,"filtered":12,"published":23515,"retry":2048,"total":23527},"queue":{"acked":23515}}},"registrar":{"states":{"cleanup":2,"current":4,"update":23527},"writes":{"success":7065,"total":7065}},"system":{"cpu":{"cores":2},"load":{"1":0,"15":0.05,"5":0.01,"norm":{"1":0,"15":0.025,"5":0.005}}}}}}
2020-05-26T07:20:52.835+0800    INFO    [monitoring]    log/log.go:154  Uptime: 8h34m11.756256865s
2020-05-26T07:20:52.835+0800    INFO    [monitoring]    log/log.go:131  Stopping metrics logging.
2020-05-26T07:20:52.835+0800    INFO    instance/beat.go:444    filebeat stopped.

解决方案

自定义Service方式启动

vim /usr/lib/systemd/system/filebeat.service
chmod +x /usr/lib/systemd/system/filebeat.service

systemctl daemon-reload
systemctl enable filebeat
systemctl start filebeat
[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
上一篇 logstash.outputs.elasticsearch retrying failed action with response code 403
下一篇 Kibana新建index pattern卡住的解决
目录
文章列表
1 高等数学基础:导数的应用1:单调性、凹凸性、极值与最值
高等数学基础:导数的应用1:单调性、凹凸性、极值与最值
2
Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式
Spring Security Oauth2 中优雅的扩展自定义(短信验证码)登录方式
3
Jenkins构建ant-design-pro项目
Jenkins构建ant-design-pro项目
4
腾讯云跨账号内网互通
腾讯云跨账号内网互通
5
SpringBoot在Redis中使用BloomFilter布隆过滤器机制
SpringBoot在Redis中使用BloomFilter布隆过滤器机制
最新评论
一位WordPress评论者
一位WordPress评论者
2月12日
您好,这是一条评论。若需要审核、编辑或删除评论,请访问仪表盘的评论界面。评论者头像来自 Gravatar。