Elastalert: Sending alerts to file

Created on 29 Mar 2016  路  2Comments  路  Source: Yelp/elastalert

Is there an option to redirect alerts to a file using "command"?

Most helpful comment

Not directly, but you could do

alert: command
command: ["tee", "-a", "/path/to/file.txt"]
pipe_match_json: true

You could also use part of the match in the file path, such as

command: ["tee", "-a", "/alerts/%{username}s.log"]

where username must be a field in the documents which match the alert.

All 2 comments

Not directly, but you could do

alert: command
command: ["tee", "-a", "/path/to/file.txt"]
pipe_match_json: true

You could also use part of the match in the file path, such as

command: ["tee", "-a", "/alerts/%{username}s.log"]

where username must be a field in the documents which match the alert.

output comes out messy, so if you need to have it the way it's being sent to email try this:

cat /path/to/file.txt | grep -v "INFO" | tr "," "n" | sed 's/"@log_name":/nn"@log_name":/' | sed 's/"//g' > /path/to/new_file.txt

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shortstack picture shortstack  路  3Comments

AweiWoo picture AweiWoo  路  3Comments

junaid1460 picture junaid1460  路  3Comments

PMDubuc picture PMDubuc  路  3Comments

serialdoom picture serialdoom  路  3Comments