Hi
i have a requirement of parsing netstat logs using logstash, sample logs looks like bellow:
the logstash configuration which i tried is here:
input {
file
{
path => "/home/samplelog"
start_position => "beginning"
}
}filter {
dissect {
mapping => {
"message" => "TIME: %{time}
%{}"
}
}if [message] =~ /^\s+(TCP|UDP)/ {
dissect {
mapping => {
"message" => "%{?tmp->} %{Protocol->} %{localAdd->} %{Foreign Address->} %{state}"
}
}
} else {
drop {}
}}
output
{
if "_grokparsefailure" not in [tags]
{
elasticsearch {
hosts => ["localhost:9200"]
index => "anyindex"
}
}stdout { codec => rubydebug }
}
resulted outcome from above configuration is :
{
"Protocol" => "TCP",
"localAdd" => "",
"time" => "",
"path" => "/home/avk03/JarAndZip/jar-file/config/logstash-6.1.1/Logs/try.txt",
"state" => " 0.0.0.0:445 0.0.0.0:0 LISTENING",
"@timestamp" => 2018-06-15T10:08:19.779Z,
"@version" => "1",
"message" => " TCP 0.0.0.0:445 0.0.0.0:0 LISTENING",
"host" => "avk03-Vostro-3800",
"Foreign Address" => ""
}
the parser is not reading lines Which contains TIME data, i am not able to resolve this issue please help.