1、安裝html
[root@jumpserver tools]# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.4.0-x86_64.rpm [root@jumpserver tools]# rpm -ivh filebeat-6.4.0-x86_64.rpm
#查看安裝內容 [root@jumpserver tools]# rpm -ql filebeat-6.4.0 /etc/filebeat/fields.yml /etc/filebeat/filebeat.reference.yml /etc/filebeat/filebeat.yml => 配置文件 /etc/init.d/filebeat => 啓動腳本 /lib/systemd/system/filebeat.service => systemctl也能夠啓動 /usr/bin/filebeat => filebeat命令
....
2、配置正則表達式
配置文件默認是/etc/filebeat/filebeat.yml,能夠參考filebeat.reference.yml 和/etc/filebeat/filebeat.yml ,配置文件支持正則表達式,官方文檔(https://www.elastic.co/guide/en/beats/filebeat/6.2/regexp-support.html)ide
配置格式爲:ui
#global filebeat configuration options tags: ["10.0.3.199"] max-procs: 1 #Configure inputs filebeat.inputs: - type: log paths: => 日誌路徑,支持正則 - /var/log/httpd/*log fields: => 輸出日誌中添加額外的字段,用於日誌過濾 service: httpd_log => httpd_log 爲自定義字段, logstash的輸出能夠看到 fields_under_root: true => 自定義字段在第一行,不會被覆蓋 #Configure the output output.logstash: => 這裏輸出到logstash hosts: ["10.0.3.60:5044"] => logstash主機 IP + Port compression_level: 0 => 0表示不進行壓縮,壓縮級別有0-9
官網下載地址
https://www.elastic.co/cn/downloads/beats/filebeatspa
官方文檔:
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-getting-started.html#filebeat-getting-started日誌