filebeat.prospectors: # 採集系統日誌 - input_type: log paths: /var/log/messages paths: /var/log/cron document_type: "messages" # 指定 註冊表文件,用於記錄上次讀取的位置,默認位於filebeat下的data目錄 registry_file: /data/filebeat/data/registry
192.168.1.197 logstash+kibana 192.168.1.202 elasticsearch 192.168.4.121 filebeat(收集服務日誌)
[root@Kibana conf.d]# pwd /usr/local/logstash/conf.d [root@Kibana conf.d]# cat beats.conf input { beats { port => 5044 } } output { elasticsearch { hosts => ["192.168.1.202:9200"] index => "microservice-log-%{+YYYY.MM.dd}" } } #啓動logstash [root@Kibana conf.d]# nohup /usr/local/logstash/bin/logstash -f /usr/local/logstash/conf.d/beats.conf & #logstash收集日誌的端口,防火牆須要開放 [root@Kibana conf.d]# ss -lntup|grep 5044 tcp LISTEN 0 128 :::5044 :::* users:(("java",pid=22292,fd=112))
[root@mos-node1 filebeat]# cd /usr/local/src/ [root@mos-node1 src]# ll total 11388 -rw-r--r--. 1 root root 11661263 Sep 26 09:54 filebeat-6.0.0-linux-x86_64.tar.gz [root@mos-node1 src]# tar xf filebeat-6.0.0-linux-x86_64.tar.gz [root@mos-node1 src]# mv filebeat-6.0.0-linux-x86_64 ../filebeat [root@mos-node1 filebeat]# cd /usr/local/filebeat/ [root@mos-node1 filebeat]# cat filebeat.yml filebeat.prospectors: - input_type: log paths: - /var/log/uusafe/*/*/server.log exclude_lines: ["^DBG","^$"] document_type: "messages" output.logstash: hosts: ["192.168.1.197:5044"] enabled: true worker: 1 compression_level: 3 loadbalance: true [root@mos-node1 filebeat]# nohup /usr/local/filebeat/filebeat &