Hello.
I'm having troubles with parsing the response of making PING to our servers, my failure is with the PING error packets.
With a good PING its ok, but parsing the next line doesn't work:
--- 192.168.1.1 ping statistics --- 1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms
So, all the good pings are stored OK, but the one that doesn't work gives me a _grokparsefailure.
I use the next code to match:
input {
tcp {
port => 50000
type => pingremote
codec => multiline {
pattern => "^---"
what => "next"
}
}
udp {
port => 50000
type => pingremote
codec => multiline {
pattern => "^---"
what => "next"
}
}
}
filter {
if [type] == "pingremote" {
grok {
match => { "message" => [ "%{NUMBER:bytes} bytes from %{HOSTNAME:TO_HOST} \(%{IP:iphost}\): icmp_seq=%{NUMBER:icmpseq:int} ttl=%{NUMBER:ttl:int} time=%{NUMBER:ms:float} ms",
"--- %{HOSTNAME:TO_HOST} ping statistics --- 1 packets transmitted, 0 received, %{GREEDYDATA}1 %{GREEDYDATA} %{NUMBER:ms:float}ms"
]
}
add_field => [ "FROM_HOST", "%{host}" ]
}
mutate{
remove_field => ["bytes","port","host", "icmpseq", "ttl", "message"]
}
if "_grokparsefailure" in [tags] {
drop { }
}
}
}
output {
if [type] == "pingremote"{
elasticsearch {
hosts => ["X.X.X.X:9200"]
index => "pingremote-%{+YYYY.MM.dd}"
}
}
}
Basicaly I join the starting with "---" with the next line so I can obtain the name of the host and match with 1 packet lost.
In grokdebug I tested it with the next match and worked, but it doesn't work in the real life.
--- %{HOSTNAME:ip} ping statistics --- 1 packets transmitted, 0 received, \+1 errors, 100% packet loss, time %{NUMBER:ms:float}ms
Thank you and sorry if I didn't explained it well.
