Elastic Stack之 Filebeat 6.7.1版本安装

1、截至目前Elasticsearch 版本已经更新到了7.10.1版本了,这里先使用Filebeat 6.7.1版本,给一个下载地址,如下所示:

官方下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch

2、Beats入门学习。Lightweight Data Shipper,轻量级的数据传送者。

  1)、Filebeat,主要用于日志文件处理。处理流程:输入Input、处理Filter、输出Output。  2)、Metricbeat,主要用来度量数据。要用来搜集cpu数据,内存数据,磁盘数据,nginx,mysql。  3)、Packetbeat,主要用来处理网络数据,主要针对网络数据,可以抓包进行分析。  4)、Winlogbeat,主要用来处理Windows数据。  5)、Auditbeat。  6)、Heartbeat建康检查。  7)、Functionbeat。

3、Filebeat,主要用于对日志文件进行处理,Filebeat的配置简介:

1)、Filebeat Input配置简介,使用的是yaml语法。input_type目前有两个类型,分别是log日志文件、stdin标准输入。

1 案例如下所示:
2 filebeat.prospectors:
3     -input_type:log  # 日志文件,有两个类型,分别是log日志文件、stdin标准输入。
4         paths:  # 日志文件路径
5             -/var/log/apache/httpd-*.log
6     -input_type:log
7         paths:
8             -/var/log/messages
9             -/var/log/*.log

2)、Filebeat Output配置简介,支持的Output对象包含,Console标准输出、Elasticsearch、Logstash、Kafka、Redis、File文件。

1 案例如下所示:
2 output.elasticsearch:
3     hosts:["http://localhost:9200"]      # 案例一,elasticsearch的连接地址
4     username:"admin"                     # 用户权限认证,需要配置账号密码
5     password:"123456"
6         
7 output.console:                          # 案例二,输出到控制台,方便调试。
8     pretty:true                          # 输出做json的格式化。

3)、Filebeat Filter配置简介,Filbeat可以对输入内容进行一定处理的,包含Input时处理、Output前处理,如下所示:

  a)、Input 时处理。

    Include_lines : 达到某些条件的时候,读入这一行。
    exclude_lines :达到某些条件的时候,不读入这一行。
    exclude_files:当文件名符合某些条件的时候,不读取这个文件。

  b)、output 前处理 --Processor。

    drop_event :读取到某一条,满足了某个条件,不输出。
    drop_fields :读取到某一条,满足了某个条件,不输出这个字段。
    Decode_json_fields :把这条数据里面符合json格式的字段,去做json的解析。
    Include_fields :加入一些字段,或者是只想取数据里面的某一些字段。

 1 案例如下所示:
 2 processors:    # 案例一
 3     -drop_event:
 4         when:
 5             regexp: # 正则表达式,当匹配到message字段以DBG开头的进行丢弃。
 6                 message:"^DBG:"
 7             
 8 processors: # 案例二
 9     -decode_json_fields: # 将结果处理成正常的json格式的。
10         fields:["inner"]

4)、Filebeat高级使用简介:

  Filebeat + Elasticsearch Ingest Node的组合使用,原因是因为Filebeat 缺乏数据转换的能力。
  Elasticsearch Ingest Node介绍如下所示,新增的node类型,在数据写入es前对数据进行处理转换,使用的api是pipeline api。

4、将下载好的Filebeat上传到服务器,然后进行解压缩,然后将解压缩后的包授权给elsearch用户,如下所示:

1 [root@k8s-master package]# tar -zxvf filebeat-6.7.1-linux-x86_64.tar.gz -C /usr/local/elastic/

由于使用的是root进行解压缩操作的,将文件拥有者赋予给elsearch自己新建的用户和用户组。

 1 [root@k8s-master elastic]# ll
 2 total 0
 3 drwxr-xr-x  9 elsearch elsearch 155 Jan  9 23:08 elasticsearch-6.7.1
 4 drwxr-xr-x  5 root     root     212 Jan 10 19:27 filebeat-6.7.1-linux-x86_64
 5 drwxr-xr-x 13 elsearch elsearch 263 Jan  9 23:41 kibana-6.7.1-linux-x86_64
 6 [root@k8s-master elastic]# chown -R elsearch:elsearch filebeat-6.7.1-linux-x86_64/
 7 [root@k8s-master elastic]# ll
 8 total 0
 9 drwxr-xr-x  9 elsearch elsearch 155 Jan  9 23:08 elasticsearch-6.7.1
10 drwxr-xr-x  5 elsearch elsearch 212 Jan 10 19:27 filebeat-6.7.1-linux-x86_64
11 drwxr-xr-x 13 elsearch elsearch 263 Jan  9 23:41 kibana-6.7.1-linux-x86_64
12 [root@k8s-master elastic]# cd filebeat-6.7.1-linux-x86_64/
13 [root@k8s-master filebeat-6.7.1-linux-x86_64]# ll
14 total 36700
15 -rw-r--r--  1 elsearch elsearch   146747 Apr  2  2019 fields.yml
16 -rwxr-xr-x  1 elsearch elsearch 37162115 Apr  2  2019 filebeat
17 -rw-r--r--  1 elsearch elsearch    69996 Apr  2  2019 filebeat.reference.yml
18 -rw-------  1 elsearch elsearch     7714 Apr  2  2019 filebeat.yml
19 drwxr-xr-x  4 elsearch elsearch       24 Apr  2  2019 kibana
20 -rw-r--r--  1 elsearch elsearch    13675 Apr  2  2019 LICENSE.txt
21 drw
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值