Hi
i need a help in constructing the logstash output
i am having two log files like this, one is
<#> 20200806 17:04:23.261 280018000 EV.INF [ MVINB-LSL2.T1G1_WEBSVR1 main.main TSP1.T1G1_WEBSVR1 ] Process T1G1_WEBSVR1 starting in progress...
other one is
<#> 20200806 17:04:23.261 280018000 EV.INF [ MVINB-LSL2.T1G1_WEBSVR1 main.main TSP1.T1G1_WEBSVR1 ] Process T1G1_WEBSVR1 starting in progress...
and here is my logstash conf
input{
stdin {
}
}
filter {
grok{
match => {
"message"=> "<#>\s*(?<@log_date>%{YEAR}%{MONTHNUM}%{MONTHDAY}\s*%{TIME})\s*\s*%{INT:event_id}\s*\s*%{GREEDYDATA:event_type}\s*\s*[\s*\s*%{HOSTNAME:host_name}.%{USERNAME:Process_name}\s%{HOSTNAME:thread}\s*\s*\s*\s*\s*\s*%{USERNAME:logger_name}\s*\s*\s*\s*\s*]\s*\s*%{GREEDYDATA:log_message}"
}
}
date
{
match => ["@log_date", "YYYYMMDD HH:mm:ss.SSS"]
target => "@log_date"
}
mutate {
gsub => [ "event_type" , "FD.INF" , "Info"]
gsub => [ "event_type" , "FD.FNE" , "Fine"]
gsub => [ "event_type" , "TR.FNE" , "Fine"]
gsub => [ "event_type" , "DE.INF" , "Info"]
gsub => [ "event_type" , "FD.WRN" , "Warning"]
gsub => [ "event_type" , "EV.WRN" , "Warning"]
gsub => [ "event_type" , "DE.WRN" , "Warning"]
gsub => [ "event_type" , "TR.FNS" , "Finest"]
gsub => [ "event_type" , "FT.FNR" , "Finer"]
gsub => [ "event_type" , "EV.INF" , "Info"]
gsub => [ "event_type" , "FT.FNS" , "Finest"]
gsub => [ "event_type" , "FT.FNE" , "Finest"]
gsub => [ "event_type" , "EV.ERR" , "Error"]
gsub => [ "event_type" , "ST.ERR" , "Error"]
gsub => [ "event_type" , "DE.ALL" , "Error"]
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "mdynamic logs"
}
}
Now here i want to create index different index based on Process name. Can i know how to use if else in the logstash output to elastics search and create index based on process name
Thanks and regards
Lokesh babloo