小编Yuv*_*pta的帖子

如何管理从多个节拍到集中式Logstash的输入

我想使用Elastic Stack进行日志聚合以从10台计算机中获取日志。我希望在10台计算机上安装Filebeat,并从每台计算机上获取日志,然后将其发送到安装在单独计算机上的集中式Logstash服务器。在单独的计算机上,安装了Logstash Elasticsearch&Kibana。我需要Logstash,因为我想在使用Beats收集日志后进行数据的处理和解析。

按照这种体系结构,我面临一些标识和解析日志的问题。如何使Logstash标识一次从多个Beats服务器收集日志?我可以在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
Run Code Online (Sandbox Code Playgroud)

这种设置类型将在所有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 }
} …
Run Code Online (Sandbox Code Playgroud)

elasticsearch logstash kibana-4 logstash-configuration filebeat

5
推荐指数
1
解决办法
5541
查看次数