Elastic Stack系列之在基于docker的ELK上新增filebeat(二)

上面一篇已经讲解了如何基于docker构建ELK环境。接下来记录一下,在ELK的基础上新增filebeat的方法。

1、下载filebeat的软件包

在这个例子中我们用的是目前filebeat的最新版本即7.4.2,下载地址为://download.csdn.net/download/yangqinfeng1121/11975165

把filebeat放到要抽取日志的服务上,并解压开

tar zvxf filebeat-7.4.2-linux-x86_64.tar.gz

2、安装filebeat

   1、进入到filebeat文件夹下,修改filebeat.yml的配置文件

- type: log

  # Change to true to enable this input configuration.
  enabled: true

  # Paths that should be crawled and fetched. Glob based paths.
  paths:
  #抽取日志的地址
    - /data/springboot/logs/jdcaisher/app/*.log

  # 日志多行合并采集
  multiline.pattern: '^\['
  multiline.negate: true
  multiline.match: after
  #tag名称
  tags: ["jdcaisher"]
  # 这个文件记录日志读取的位置,如果容器重启,可以从记录的位置开始取日志
  #registry_file: /usr/share/filebeat/data/registry


#-------------------------- Elasticsearch output ------------------------------
#把输出的ES的部分注释
#output.elasticsearch:
  # Array of hosts to connect to.
  # hosts: ["localhost:9200"]

#----------------------------- Logstash output --------------------------------
#向自己的logstash发送日志
output.logstash:
  # The Logstash hosts
  hosts: ["172.16.0.39:5044"]

3、启动filebeat

后台守护进程
nohup ./filebeat > /dev/null 2>&1 &

 

4、这时正在kibana上就能看到filebeat抽取过来的日志了

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章