I am able to generate mails based on events in log file but I am not able to throttle it.
below is my config file.
============================================
input {
beats {
port => 5044
}
}
filter {
if [type] == "hascript_log" {
grok {
match => { "message" => "%{TIMESTAMP_ISO8601:ts}|%{IPORHOST:hostname}|%{WORD:level}|%{GREEDYDATA:txt}" }
}
throttle {
before_count => -1
after_count => 1
period => 60
max_age => 120
key => "%{message}"
add_tag => "throttled"
}
if "throttled" in [tags] {
drop { }
}
}
}
output {
stdout { codec => rubydebug
}
if [type] =="hascript_log" {
elasticsearch {
index => "audit-%{+YYYY.MM.dd}"
hosts => ["localhost:9200"]
}
if "throttled" not in [tags] {
email {
debug => true
address => "mail server ip"
port => 25
body => " This is notification mailto report error in HA configuration for \n\n Detailed Description \n\n\n :\n'%{message}' \n\n\n"
from => "mail id"
subject => "Error in HA Configuration "
to => "Amit_Kashyap@DellTeam.com"
}
}
}
}