今天记录下Filebeat,由于工作中是多个interface导入数据的,所以针对接口产生的日志,我们用Filebeat来收集,下面简单的介绍下安装和使用
-
我们登陆到Filebeat的下载网站,去下载相关的软件
https://www.elastic.co/cn/downloads/beats/filebeat -
将下载的文件放到linux服务器上,并解压 (filebeat-7.0.1-linux-x86_64.tar.gz)
tar -xzvf file.tar.gz //解压tar.gz -
编辑filebeat.yml配置文件
3.1 配置filebeat.inputs(获取log的目录等信息) 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. - type: log # Change to true to enable this input configuration. enabled: true fields: service: helm # Paths that should be crawled and fetched. Glob based paths. paths: # - /var/log/*.log - /appl/helm/helm_log.log
3.2 配置output.logstash(将获取的log传给logstash做处理): ``` output.logstash: # The Logstash hosts hosts: ["localhost:5044"] enabled: true ```
-
后台运行启动
nohup ./filebeat -e -c filebeat.yml > filebeat.log & -
完成配置,这样就可以将相关的log传给logstash,如果有其他问题,请参见filebeat.yml配置文件注解