大数据Elasticsearch之轻量级日志采集工具FileBeat的安装、配置与使用


beats

beats是一个代理,将不同类型的数据发送到elasticsearch。beats可以直接将数据发送到elasticsearch,也可以通过logstash将数据发送elasticsearch。


Filebeat

Filebeat是File采集专用beats,用来收集日志


1. 下载&解压

$ wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.3.2-linux-x86_64.tar.gz
$ tar -zxvf filebeat-7.3.2-linux-x86_64.tar.gz

2. 配置filebeat.yml

     #定义日志文件路径
     filebeat.inputs:
     - type: log
        enabled: true
        paths:
             - /var/log/*.log
    #发送到Elasticseach
     output.elasticsearch:
        hosts: ["192.168.0.22:9200"]
    #如果要用kibana仪表盘
     setup.kibana:
        host: "localhost:5601"
    #如果有安全策略,则需要指定访问凭据
    output.elasticsearch:
        hosts: ["elasticsearchlocalhost:9200"]
        username: "elasticsearch"
        password: "pwd"
     setup.kibana:
        host: "kibanalocalhost:5601"
        username: "kibana"
        password: "pwd"
    #如果使用logstash
     output.logstash:
        hosts: ["127.0.0.1:5044"]
     #索引模板加载。索引模板用于定义设置和映射,以确定如何分析字段。默认模板文件 fields.yml
     #加载不同的模板
     setup.template.name: "template"
     setup.template.fields: "path/to/fields.yml"
    #覆盖一个已存在的模板
     setup.template.overwrite: true
    #禁用自动加载模板
     setup.template.enabled: false
    #修改索引名称
     # 默认情况下,Filebeat写事件到名为filebeat-6.3.2-yyyy.MM.dd的索引,其中yyyy.MM.dd是事件被索引的日期。为了用一个不同的名字,你可以在Elasticsearch输出中设置index选项。例如:
     output.elasticsearch.index: "customname-%{[beat.version]}-%{+yyyy.MM.dd}"
     setup.template.name: "customname"
     setup.template.pattern: "customname-*"
     setup.dashboards.index: "customname-*"    

3. 启动Filebeat

$ ./filebeat -e -c filebeat.yml -d "publish"
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值