multiline.pattern: \d\d/\d\d/\d\d\d\d\s\d\d:\d\d:\d\d\s\d\d\d-\sMAIN\sEXCEPTION\b
multiline.negate: true
multiline.match: after
multiline.max_lines: 7
Logstash configuration:
input {
beats {
type => "test"
port => "5044"
}
}
output{
stdout {
codec => rubydebug
}
email {
to => "aa@gmail.com"
via => 'smtp'
address => 'smtp.gmail.com'
domain => 'smtp.gmail.com'
from => 'jo@gmail.com'
authentication => "plain"
username => "jo@gmail.com"
password => "pass"
subject => 'Alert '
body => "%{message}"
port => 25
use_tls => true
}
elasticsearch {
hosts => ["localhost:9200"]
}
}
Imagine that in one file i have the same message like more than 50 for example will send me a 50 emails so i want to add a filter bloc or somthing to just send me one email contains this message if it's similar to others.
Thanks for the reply,
i don't understand what should i use,
I just want if there is the word "EXCEPTION" in this file send me just one mail contains there is EXCEPTION in this file ...
That will tag any messages before the first (there aren't any), and any messages after the third, so there will be 3 messages you do not drop. If you just want the first then use
Thanks Badger it works ,
That was my bad was testing with a different message the time make me wrong...
Last question, i give a file at first and it works good but if i give another file after 10min for example did not work
filter {
if !("IOException" in [message]) {drop{}}
throttle {
before_count => -1
after_count => 1
period => 600
max_age => 1200
key => "%{host}%{message}"
add_tag => "throttled"
}
if "throttled" in [tags] {
drop { }
}
}
What should i update to make this works when i give a new file anytime?
If you want to make the throttle dependent on the name of the file that events came from you would have to use an aggregate filter rather than throttle. You have set period to 600 so all events except one in a ten minute period will be throttled.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.