我想使用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 }
}
更多想法,欢迎。