Hi, in input I use 2 ports by 2 project, I want handle them to different indices. But now all input go to prd.rnis-* index. Can you help?
input {
syslog {
port => 5001
tags => ["prd.rnis"]
grok_pattern => "<%{NONNEGINT:syslog_pri}>%{NONNEGINT:version}%{SPACE}(?:-|%{TIMESTAMP_ISO8601:syslog_timestamp})%{SPACE}(?:-|%{IPORHOST:hostname})%{SPACE}(?:%{SYSLOG5424PRINTASCII:program}|-)%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:process_id})%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:message_id})%{SPACE}(?:-|(?<structured_data>(\[.*?[^\\]\])+))(?:%{SPACE}%{GREEDYDATA:syslog_message}|)"
}
syslog {
port => 5002
tags => ["dem.nisr"]
grok_pattern => "<%{NONNEGINT:syslog_pri}>%{NONNEGINT:version}%{SPACE}(?:-|%{TIMESTAMP_ISO8601:syslog_timestamp})%{SPACE}(?:-|%{IPORHOST:hostname})%{SPACE}(?:%{SYSLOG5424PRINTASCII:program}|-)%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:process_id})%{SPACE}(?:-|%{SYSLOG5424PRINTASCII:message_id})%{SPACE}(?:-|(?<structured_data>(\[.*?[^\\]\])+))(?:%{SPACE}%{GREEDYDATA:syslog_message}|)"
}
}
filter {
json {
source => "syslog_message"
}
}
output {
if "prd.rnis" in [tags] {
elasticsearch {
hosts => [ "elasticsearch:9200" ]
index => "prd.rnis-%{+YYYY.MM.dd}"
}}
if "dem.nisr" in [tags] {
elasticsearch {
hosts => [ "elasticsearch:9200" ]
index => "dem.nisr-%{+YYYY.MM.dd}"
}}
stdout { codec => rubydebug }
}