【发布时间】:2021-02-23 07:49:33
【问题描述】:
我对 Logstash (v7.11) 和 Elasticsearch 有一个奇怪的问题。
我目前有两个配置文件:
-
01-beats-syslog.conf(带有由 winlogbeat 发送的日志)
input { beats { port => 5044 ssl => false } } filter { if [type] == "syslog" { grok { match => { "message" => "%{SYSLOGLINE}" } } date { match => [ "timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] } } } output { elasticsearch { hosts => localhost index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}" } stdout { codec => rubydebug } } -
02-network-syslog.conf(带有无代理设备(例如交换机、防火墙等)的日志)
input { tcp { port => 514 type => syslog } udp { port => 514 type => syslog } } filter { if [type] == "syslog" { grok { match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" } add_field => [ "received_at", "%{@timestamp}" ] add_field => [ "received_from", "%{host}" ] } date { match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] } } } output { elasticsearch { hosts => ["localhost:9200"] index => "syslog-%{+YYYY.MM}" } stdout { codec => rubydebug } }
由于某种原因,“winlogbeat”日志的副本最终位于“network-syslog”索引中(除了真正的 syslog 流量)。每个配置文件都在侦听不同的端口,这有什么问题配置?
我还检查了我没有将流量转发到 514 的防火墙规则,实际上使用 tcpdump 我看不到来自该端口上的 winlogbeat 的流量。
【问题讨论】:
标签: elasticsearch logstash elastic-stack