I would like to have some help to configure multiple indexes from multiple entries with logstash.
Is my configuration below correct?
input {
tcp {
port => "5140"
codec => json
type => "syslog"
}
tcp {
port => "5141"
codec => json
type => "syslog"
}
tcp {
port => "5142"
codec => json
type => "syslog"
}
}
filter {
grok {
match => { "message" => "%{SYSLOG5424PRI:syslog_index}-\s*%{SYSLOGHOST:syslog_hostname} %{GREEDYDATA:syslog_message}" }
}
json {
source => "syslog_message"
}
}
output {
stdout { codec => rubydebug }
if port => "5140" {
elasticsearch {
hosts => ["https://xxxx:9200", "https://xxxx:9200"]
user => "elastic"
password => "xxxxx"
cacert => "/etc/logstash/certs/ca.crt"
index => "jstest1-%{+YYYY.MM.dd}"
action => "index"
}
}
if port => "5141" {
elasticsearch {
hosts => ["https://xxxxx:9200", "https://xxxxx:9200"]
user => "elastic"
password => "xxxx"
cacert => "/etc/logstash/certs/ca.crt"
index => "jstest2-%{+YYYY.MM.dd}"
action => "index"
}
}
if port => "5142" {
elasticsearch {
hosts => ["https://xxxx:9200", "https://xxxx:9200"]
user => "elastic"
password => "xxxxxxxx"
cacert => "/etc/logstash/certs/ca.crt"
index => "jstest3-%{+YYYY.MM.dd}"
action => "index"
}
}
}