I am trying to output based on different sysloghosts
input {
udp {
port => 5010
type => "obs_test_udp"
}
}
filter {
grok {
match => {"message" => "<%{POSINT:syslog_priority}>%{POSINT:syslog_version} %{TIMESTAMP_ISO8601:timestamp} %{SYSLOGHOST:sysloghost}"}
}
}
output {
if [sysloghost] in ["10.3.0.20", "10.2.0.12"] {
file {
path => "/usr/share/logstash/log/bob.log"
}
}
else if [sysloghost] in ["bk-bot-bot"] {
file {
path => "/usr/share/logstash/log/alice.log"
}
}
else {
file {
path => "/usr/share/logstash/log/ohno.log"
}
}
}
I can see the sysloghost file in the ohno log file, but I cannot filter based on it
{"host":"10.101.192.143","syslog_version":"1","@timestamp":"2024-01-09T16:10:43.649810154Z","message":"<13>1 2024-01-09T11:10:43.755197-05:00 bk-bot-bot bk - - [timeQuality tzKnown=\"1\" isSynced=\"1\" syncAccuracy=\"30500\"] Medford is kewl","sysloghost":"bk-bot-bot","timestamp":"2024-01-09T11:10:43.755197-05:00","@version":"1","type":"obs_test_udp","syslog_priority":"13"}