I've been playing around with logstash and wanting to know how to exactly configure email alerting correctly.
I'm looking to pick up the string "BVDCS_LAP" and send a mail onto that address given.
The config I have is:
input {
udp {
port => 5000
type => syslog
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "received_from", "%{host}" ]
}
syslog_pri { }
date {
match => [ "syslog_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ]
}
}
}
output {
elasticsearch { host => localhost }
stdout { codec => rubydebug }
}
email {
from => "mymail@domain"
match => {
"BVDCS_LAP", "message,BVDCS_LAP",
"BVDCS_LAP", "message,BVDCS_LAP"
}
subject => "%{matchName}"
to => "mymail@domain"
via => "smtp"
body => "Here is the event line that occured: %{message}"
htmlbody => "<h2>%{matchName}</h2><br/><br/><h3>Full Event</h3><br/><br/><div align='center'>%{@message}</div>"
}
}
E-mails are not being sent and in my logstash.conf I'm seeing the below on line 27:
{:timestamp=>"2015-07-07T12:55:50.597000+0100", :message=>"Error: Expected one of #, input, filter, output at line 27, column 8 (byte 649) after "}
I’m curious as well to know if my original grok coding is correct and also if we could work out how to set a tag for a syslog message and use that as the email output?
Thanks