天天看點

ELK 7.5.0(六)Filebeat二進制安裝

一、實驗環境

主機名        IP
es        192.168.14.210
kibana    192.168.14.210
Filebeat  192.168.14.213
nginx     192.168.14.213
           

Filebeat - -> Elasticsearch - - > Kibana架構

二、安裝部署

1、Kibana檢視第二章節

2、Elasticsearch檢視第三章節

三、安裝Filebeat

1、官網下載下傳Filebeat二進制包

https://www.elastic.co/cn/downloads/past-releases#filebeat

2、解壓二進制包

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable  firewalld

[[email protected] ~]# tar -zxvf filebeat-7.5.0-linux-x86_64.tar.gz
[[email protected] ~]# mv filebeat-7.5.0-linux-x86_64 /usr/local/filebeat-7.5.0  
           

3、添加環境變量

[[email protected] ~]# vi /etc/profile
export PATH=$PATH:/usr/local/filebeat-7.5.0 
           

4、修改Filebeat配置檔案

[[email protected] ~]# vi /usr/local/filebeat-7.5.0/filebeat.yml
filebeat.inputs:
- type: log
  tail_files: true
  backoff: "1s"
  paths:
      - /usr/local/nginx/logs/access.log        #nginx日志路徑

output:
  elasticsearch:
    hosts: ["192.168.14.210:9200"]              #es伺服器IP
    username: "elastic"                         #認證使用者名和密碼
    password: "elkpwd"
           

5、啟動Filebeat,指定配置檔案(filebeat7.5.0版本發現背景啟動會自動退出)

#先前台啟動,檢視是否有報錯
[[email protected] ~]# filebeat -e -c /usr/local/filebeat-7.5.0/filebeat.yml

#沒有異常可以考慮背景啟動
[[email protected] ~]# nohup filebeat -e -c /usr/local/filebeat-7.5.0/filebeat.yml  >/tmp/filebeat.log 2>&1 &
           

6、在kibana檢視索引

ELK 7.5.0(六)Filebeat二進制安裝

至此Filebeat - -> Elasticsearch - - > Kibana設定完成

四、filebeat和logstash對比

Filebeat:輕量級,但不支援正則、不能移除字段等

Logstash:比較重,但支援正則、支援移除字段等

filebeat隻适合直接在kibana頁面檢視日志,不适合具體日志的分析過濾。如果需要分析日志,可以此基礎上引入logstash,形成Filebeat - -> Logstash - -> Elasticsearch - -> Kibana架構。

繼續閱讀