Hi,
I have setup filebeat on a pi running Snort sending logs to a cloud ELK stack. I am trying to figure out how to arrange logs and doing the following process:
on the beats side i have this in the filebeat.yml:
paths:
- /var/log/snort/alert
tags: ["snort"]
Whilst in the filter on the logstash side I have the below:
if "snort" in [tags] {
# parse the message into individual fields
grok {
match => { "message" => "(?<ts>.*\d{2}:\d{2}:\d{2})\s(?<host>.*?)\s.*?\s\[(?<generator_id>.*?)::(?<signature_id>.*?):.*?\]\s(?<signature>.*?)\s\[Classification:\s(?<classification>.*?)\]\s\[Priority:\s(?<priority>.*?)\].*?{(?<protocol>.*?)\}\s(?<source_ip>.*?):(?<source_port>.*?)\s-\>\s(?<destination_ip>.*?):(?<destination_port>.*)" }
}
# remove the original message if parsing was successful
if !("_grokparsefailure" in [tags]) {
mutate {
remove_field => [ "message" ]
}
}
# parse the timestamp and save in a new datetime field
if [ts] {
date {
match => [ "ts", "MMM dd HH:mm:ss" ]
target => "sys_timestamp"
}
# remove the original timestamp if date parsing was successful
if !("_dateparsefailure" in [tags]) {
mutate {
remove_field => [ "ts" ]
}
}
}
}
A sample log file in snort looks as such:
04/22-17:47:29.436774 [] [1:29456:2] PROTOCOL-ICMP Unusual PING detected [] [Classification: Information Leak] [Priority: 2] {ICMP} 192.168.4.1 -> 192.168.4.9
Unfortunately the above is not working and noticed a tag in Kibana with snort logs as follows: _grokparsefailure.
Any thoughts on making this work?