對每一臺機器上都裝一個filebeat,而後都指向同一個logstash,這時不一樣的filebeat傳輸的數據過來,須要輸出到不一樣的索引,nginx
filebeat.prospectors: - type: log enabled: true paths: - /var/log/nginx-json/access.log input_type: log fields.document_type: nginx fields.service: nginx tags: ["nginx"] filebeat.config.modules: path: ${path.config}/modules.d/*.yml reload.enabled: false output.logstash: hosts: ["10.0.0.5:5044"]
output { if [fields][service] == "nginx"{ elasticsearch { hosts => ["http://localhost:9200"] index => "h5-nginx-%{+YYYY.MM.dd}" } } }