小于博客 小于博客
首页
  • Java学习笔记
  • Docker专区
  • 实战教程
  • Shell
  • 内存数据库
  • Vue学习笔记
  • Nginx
  • Php
  • CentOS
  • Docker
  • Gitlab
  • GitHub
  • MySql
  • MongoDB
  • OpenVPN
  • 配置文件详解
  • Other
  • ELK
  • K8S
  • Nexus
  • Jenkins
  • 随写编年
  • 电影音乐
  • 效率工具
  • 博客相关
  • 最佳实践
  • 迎刃而解
  • 学习周刊
关于
友链
  • 本站索引

    • 分类
    • 标签
    • 归档
  • 本站页面

    • 导航
    • 打赏
  • 我的工具

    • 备忘录清单 (opens new window)
    • 网站状态 (opens new window)
    • json2go (opens new window)
    • 微信MD编辑 (opens new window)
    • 国内镜像 (opens new window)
    • 出口IP查询 (opens new window)
    • 代码高亮工具 (opens new window)
  • 外站页面

    • 开往 (opens new window)
    • ldapdoc (opens new window)
    • HowToStartOpenSource (opens new window)
    • vdoing-template (opens new window)
GitHub (opens new window)

小于博客

行者常至,为者常成
首页
  • Java学习笔记
  • Docker专区
  • 实战教程
  • Shell
  • 内存数据库
  • Vue学习笔记
  • Nginx
  • Php
  • CentOS
  • Docker
  • Gitlab
  • GitHub
  • MySql
  • MongoDB
  • OpenVPN
  • 配置文件详解
  • Other
  • ELK
  • K8S
  • Nexus
  • Jenkins
  • 随写编年
  • 电影音乐
  • 效率工具
  • 博客相关
  • 最佳实践
  • 迎刃而解
  • 学习周刊
关于
友链
  • 本站索引

    • 分类
    • 标签
    • 归档
  • 本站页面

    • 导航
    • 打赏
  • 我的工具

    • 备忘录清单 (opens new window)
    • 网站状态 (opens new window)
    • json2go (opens new window)
    • 微信MD编辑 (opens new window)
    • 国内镜像 (opens new window)
    • 出口IP查询 (opens new window)
    • 代码高亮工具 (opens new window)
  • 外站页面

    • 开往 (opens new window)
    • ldapdoc (opens new window)
    • HowToStartOpenSource (opens new window)
    • vdoing-template (opens new window)
GitHub (opens new window)
  • Nexus系列文章

  • Jenkins系列文章

  • ELK笔记

    • ELK

    • FileBeat

      • Filebeat的Registry文件解读
      • filebeat采集端配置文件详解
      • filebeat报错too many open files处理
    • LogStash

    • ElasticSearch

    • Kibana

  • Kubernetes笔记

  • 系列专题
  • ELK笔记
  • FileBeat
小于博客
2020-06-06

filebeat报错too many open files处理

有同学反馈说api的日志可能漏采了,部分日志查不到,我于是立马进行一波查验,发现的确是有部分日志没有写到es,一开始还以为是这部分日志有问题,然后开发同学是同目录下的日志用的是同一个框架,于是又想是不是es写入有问题,看了看也没问题,后来来到主机上看filebeat的日志,发现了如下报错。

2019-12-03T15:46:22+08:00 ERR Failed to create tempfile (/var/lib/filebeat/registry.new) for writing: open /var/lib/filebeat/registry.new: too many open files
2019-12-03T15:46:22+08:00 ERR Writing of registry returned error: open /var/lib/filebeat/registry.new: too many open files. Continuing...
2019-12-03T15:46:23+08:00 ERR Harvester could not be started on existing file: /var/log/secure, Err: Error setting up harvester: Harvester setup failed. Unexpected file opening error: Failed opening /var/log/secure: open /var/log/secure: too many open files
1
2
3

如上报错是采集的日志文件超过了filebeat进程的最大文件打开数了,而超出的部分,也将无法落入到es中。

img

解决可以参考动态修改 (opens new window),但只是临时生效,一旦服务或者系统重启,就又失效了,因此在启动文件中添加配置来解决:

cat /usr/lib/systemd/system/filebeat.service
[Unit]
Description=filebeat
Documentation=https://www.elastic.co/guide/en/beats/filebeat/current/index.html
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/usr/share/filebeat/bin/filebeat -c /etc/filebeat/filebeat.yml -path.home /usr/share/filebeat -path.config /etc/filebeat -path.data /var/lib/filebeat -path.logs /var/log/filebeat
Restart=always
LimitNOFILE=10240
[Install]
WantedBy=multi-user.target
1
2
3
4
5
6
7
8
9
10
11
12

然后重启服务即可。

#filebeat#elk
上次更新: 2024/02/03, 13:17:04

← filebeat采集端配置文件详解 logstash本地调试日志方法详解→

最近更新
01
SpringBoot 快速实现 api 加密!
03-21
02
SpringBoot整合SQLite
03-07
03
SpringBoot配置使用H2数据库的简单教程
02-21
更多文章>
Theme by Vdoing | Copyright © 2017-2024 | 点击查看十年之约 | 豫ICP备2022014539号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式