我想使用Elastic Stack進行日誌聚合以從10臺機器獲取日誌。我希望在10臺機器上安裝Filebeat &從每臺機器獲取日誌,並將其發送到安裝在單獨機器中的中央Logstash服務器。在單獨的機器中,安裝了Logibash Elasticsearch & Kibana。我需要使用Logstash,因爲我想在使用節拍收集日誌之後對數據進行解析處理&。如何管理從多個節拍到中央的輸入Logstash
按照這種架構,我面臨一些識別和解析日誌的問題。如何確定logstash以便同時從多個節拍服務器收集日誌?我可以在logstash-beats插件中指定多個主機,以便Logstash一次解析來自10臺機器的所有日誌?
我應該在所有10臺機器中定義單獨的document_type作爲Filebeat Configuration的一部分,後者可以在Logstash中進行利用,以便在過濾器插件中定義多種類型(使用通配符--Tomcat *)。
樣品Filebeat配置單臺機器設置: -
################### Filebeat Configuration Example #########################
############################# Filebeat ####################################
filebeat:
prospectors:
-
paths:
- /location/to/file/catalina.out
document_type: tomcat1
scan_frequency: 5s
input_type: log
output:
logstash:
hosts: ["<host-of-the-machine-on-which-logstash-is-installed>:5044"]
console:
pretty: true
shipper:
logging:
files:
rotateeverybytes: 10485760 # = 10MB
這種類型的設置將在所有10臺機器,其中DOCUMENT_TYPE的價值只會改變來完成。
樣品Logstash配置單臺機器: -
input {
beats {
host => "ip/of/machine/1"
port => 5044
}
}
filter {
........................
........................
........................
}
output{
elasticsearch {
hosts => "localhost:9200"
index => "logs-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }
}
更多想法,歡迎。