Answer the question
In order to leave comments, you need to log in
Setting up an ELK bundle for central logging, how to accept logs from rsyslog clients?
Good day! There is a task to lift a sheaf on collection of dens through UDP from clients. I'm doing a trial test version, but pitfalls are everywhere.
Available:
stream of logs from several clients (*.*@logstash-server);
logstash configured to receive and send to elasticsearch + kibana.
logstash config (essentially copied from official documentation for receiving and processing logs from rsyslog clients)
input {
udp {
type => rsyslog
port => 50514
}
}
filter {
if [type] == "rsyslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %
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 => ["<hostname><port>]
index => "logs-%{+YYYY.MM.dd}"
}
}
Answer the question
In order to leave comments, you need to log in
I found the problem, it turned out to be simple. Simplified basic config:
input { udp {
port => 50514
type => syslog} }
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGBASE} : %{GREEDYDATA:syslog_message}" }
}
syslog_pri { }
}
}
output {
elasticsearch { hosts => ["ИМЯ ХОСТА:9200"] }
stdout { codec => rubydebug }
}
iptables -t nat -I PREROUTING -p udp --dport 50514 -j REDIRECT --to-port 514
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question