filebeat-7.2.0服务输出形式

filebeat-7.2.0服务输出形式

 配置参考:https://www.elastic.co/guide/en/beats/filebeat/7.2/configuring-howto-filebeat.html

日志输出:https://www.elastic.co/guide/en/beats/filebeat/7.2/configuring-output.html

Filebeat只能有单一输出。

A、配置console输出格式

该格式在检验日志定位过程中,常用。

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# vim filebeat.yml

output.console:

  pretty: true

 [root@linux-host2 filebeat-7.2.0-linux-x86_64]# ./filebeat -e -c filebeat.yml

可以查看实时日志。

 

 

B、配置file输出格式

该格式在检验日志定位过程中,也常用。

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# vim filebeat.yml

output.file:

  path: "/tmp/fileb"

  filename: filebe

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# ./filebeat -e -c filebeat.yml

自动生成目录和文件。

 

 

C、配置elasticsearch输出格式

不能手动创建索引,不建议使用

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# vim filebeat.yml

output.elasticsearch:

  hosts: ["192.168.19.139:9200"]

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# ./filebeat -e -c filebeat.yml

刷新界面,生成索引

 

暂无日志查看。

 

D、配置logstash输出格式

该格式配合es或者redis使用,以下是结合redis配置。

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# vim filebeat.yml

output.logstash:

  hosts: ["192.168.19.138:5044"]

  enables: true

  worker: 1

  compression_level: 3

[log@linux-host1 logstash-7.2.0]$ cat conf.d/beats.conf

input {

  beats {

    port => 5044

  }

}

output {

  if [fields][service] == "tomcat-access-139"{

  redis {

    data_type => "list"

    host => "192.168.19.139"

    db => "4"

    port => "6379"

    key => "tomcat-access-139"

    password => "12345"

  }}

}

[root@linux-host2 filebeat-7.2.0-linux-x86_64]# ./filebeat -e -c filebeat.yml

[log@linux-host1 logstash-7.2.0]$ ./bin/logstash -f ./conf.d/beats.conf

访问tomcat服务,查看redis应用。

  

还有将输出kafka、elastic Cloud等应用中。

更多参考官网:https://www.elastic.co/guide/en/beats/filebeat/7.2/configuring-output.html

posted @ 2019-08-06 18:04  wang_wei123  阅读(1808)  评论(0编辑  收藏  举报