为什么要利用FileBeat
Logstash功能固然强大,但是他依靠java,在数据量大的时间,Logstash历程会斲丧过多的体系资源,这将严肃影响业务体系的性能,而Filebeat就是一个完善的代替者,filebeat是Beat成员之一,基于Go语言开辟,没有任何依靠,设置文件简单,格式明白,同时,Filebeat比Logstash更加轻量级以是占用体系资源少少,非常得当安装到生产呆板上。
FileBeat概述
Filebeat是用于转发和会合日志 数据的轻量级发送器。Filebeat作为署理安装在您的服务器上,监视您指定的日志 文件或位置,网络日志 事故,并将它们转发到弹性搜刮大概Logstash用于索引。
Filebeat是如许工作的:当您启动Filebeat时,它会启动一个或多个输入,这些输入会在您为日志数据指定的位置中查找。对于Filebeat找到的每个日志,Filebeat都会启动一个收罗器。每个网络器读取一个新内容的日志,并将新的日志数据发送到libbeat,后者聚合事故并将聚合的数据发送到您为Filebeat设置的输出。
FileBeat安装
- #由于Filebeat基于Go语言开发,无其他依赖,因而安装非常简单,可以从elastic官网https://www.elastic.co/downloads/beats/filebeat/获取Filebeat的安装包
- #安装wget
- yum install wget
- #切换目录
- cd /usr/local/
- #下载Filebeat
- wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.13.4-linux-x86_64.tar.gz
- #解压缩 由于是下载的二进制Filebeat文件 解压即安装
- tar -xzvf filebeat-7.17.9-linux-x86_64.tar.gz -C /usr/local
- #更换名称
- mv filebeat-7.17.9-linux-x86_64 filebeat
- #到此安装完成
复制代码 简单先容FileBeat目次作用
- -rw-r--r-- 1 root root 41 1月 31 2023 .build_hash.txt
- -rw-r--r-- 1 root root 3781373 1月 31 2023 fields.yml
- -rwxr-xr-x 1 root root 112216160 1月 31 2023 filebeat* #可执行二进制文件
- -rw-r--r-- 1 root root 170372 1月 31 2023 filebeat.reference.yml
- -rw------- 1 root root 8348 1月 31 2023 filebeat.yml #配置文件
- drwxr-xr-x 3 root root 4096 1月 31 2023 kibana/
- -rw-r--r-- 1 root root 13675 1月 31 2023 LICENSE.txt
- drwxr-xr-x 76 root root 4096 1月 31 2023 module/
- drwxr-xr-x 2 root root 4096 1月 31 2023 modules.d/ #模块文件 调用模块代码都在这个里面
- -rw-r--r-- 1 root root 2058190 1月 31 2023 NOTICE.txt
- -rw-r--r-- 1 root root 814 1月 31 2023 README.md
复制代码 设置filebeat.yml设置文件
- vim filebeat.yml
- #########filebeat.yml##########################
- ###################### Filebeat Configuration Example #########################
- # This file is an example configuration file highlighting only the most common
- # options. The filebeat.reference.yml file from the same directory contains all the
- # supported options with more comments. You can use it as a reference.
- #
- # You can find the full configuration reference here:
- # https://www.elastic.co/guide/en/beats/filebeat/index.html
- # For more available modules and options, please see the filebeat.reference.yml sample
- # configuration file.
- # ============================== Filebeat inputs ===============================
- filebeat.inputs:
- # Each - is an input. Most options can be set at the input level, so
- # you can use different inputs for various configurations.
- # Below are the input specific configurations.
- # filestream is an input for collecting log messages from files.
- #
- # hk-system
- - type: log
- # Unique ID among all inputs, an ID is required.
- id: hk-system-error
- # Change to true to enable this input configuration.
- enabled: true
- # Paths that shoul
复制代码 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |