Hi, I am just beginning my story with ELK, trying to understand grok and how to filter events
Here is what I try to accomplish, I try to gather syslogs from routers and switches, here is example
I 05/23/16 11:50:14 ports: port 14 is now off-line
I 05/23/16 11:49:38 ports: port 14 is now on-line
W 05/23/16 11:49:36 ports: port 14 PD Invalid Signature indication.
I 05/23/16 11:49:35 ports: port 14 is Blocked by STP
I 05/23/16 11:49:32 ports: port 14 is now off-line
I 05/23/16 11:49:26 ip: VLAN101: network enabled on 10.101.0.130
I 05/23/16 11:49:26 ip: VLAN101: changing IP address to 10.101.0.130
All I want to do now is to catch string like "is now off-line" and then send emial alert, second part will be using Kibana to go through all logs easily, they can be raw.
Log will be flowing from multiple devices, they will be different types so I just need to catch encountered string, mark it and execute (eg send email)
input {
tcp {
type => "syslog"
port => 514
}
}
input {
udp {
type => "syslog"
port => 514
}
}
filter {
if [type] == "syslog" {
grok { check if the single sting( or strings from dictionary) exist in this message }
if yes, mark it, tag it if not do nothing just send the raw event to elasticsearch}
output {
email {
elasticsearch {
}
from => "myemail@somewhere.com"
match => [
"problem1", "problem2","problem3"
]
subject => "%{tagged_event}"
to => "you@example.com"
via => "mail"
body => "Alert something something: %{@message}"
}
}
}