Hi this might be silly but I want to know that can i schedule mail from logstash using email-plugin as i want to schedule mail which contains error message from the logs .i had successfully implemented to mail error logs.but it sends mail for each error message .so is there any way ?. if yes how to implement it. As I'm not able to find any reference on internet. So if any one finds it or has solution ,please forward me. and here is my implementation:
input {
tcp {
port => 5044
codec => json
}
}
output {
elasticsearch {
hosts => ["http://elasticsearch:9200"]
index => "%{[Properties][TrackWizzEnvironment]}-%{[Properties][ServiceName]}-%{+YYYY.MM.dd}" # Dynamic index based on fields
}
stdout { codec => rubydebug } # For debugging
if [Level] == "Error" {
email {
to => "xyz@domain.com"
from => "abc1234@domain.com"
subject => "🚨 Error Logs Detected!"
body => "We detected an error log in the last 15 minutes:%{MessageTemplate}"
address => "136.243.205.196"
port => 587
authentication => "plain"
username => "xyz@domain.com"
password => "xfgfxg@#th^$xcgv651"
use_tls => true
}
}
}