Elastalert doesn't look reliable. Takes long delay in sending alerts sometimes. (more than 20+ hours)
I've installed Elastalert latest version. The ElastAlert sends alerts at a much later time not exactly when elasticsearch receives. That is usual delay (usually 10-15 minutes). But sometimes, it takes very long delay in sending alerts and there is no way to troubleshoot it.
I am running it as a process inside tmux. Error logs appear on stdout that we can scroll up to see, but scroll buffer is limited so we can’t see older verbose output. ☹ I could’ve used “--es_debug_trace” while starting the elastalert process, but it will crowd stdout. No proper debugging methods. Elastalert doesn’t look reliable.
Could you please suggest what could be the reason? And how to resolve it.
Is there any update on this?
What is your alert destination? I'm currently using SMTP (email) as my destination and haven't experience this issue.
What is your alert destination? I'm currently using SMTP (email) as my destination and haven't experience this issue.
Yeah, I am using email as well.
Is it possible that you have some type of security gateway inspecting your email traffic? A lot of enterprises use this in their networks.
standard O365
It's certainly possible your SMTP server is receiving the message, running it through some security software, and then shooting it off to the recipient email specified in the ElastAlert rule yaml file.
If you go to the email alert generated by ElastAlert, click on File > Info > Properties (in Outlook) you will be able to see the full email details.
Are the recipient and sender email domains the same? (sender: [email protected] / recipient: [email protected]) ?
Also, if you test the rule elastalert-test-rule --config config.yaml testrule.yaml are you able to generate any hits / alerts in the output?
It is showing the company domain as sender and recipient as the analyst email ID. It works fine at most times. The issue is that it takes long delay in sending an alert for no visible reason at irregular intervals. So we couldn't debug what was wrong with Elastalert at that time. And also scrolling above to see verbose output is limited.
Have you checked the logs in elasticsearch? All errors and alerts sent are written to elastalert_status (or whatever you set it to). If you have a really large delay, it could be because your query is hitting millions of documents, that would show up as a large number in time_taken, also in the elastalert_status endpoint. Finally, have you considered writing the logs to a file instead of terminal buffer??
Finally, have you considered writing the logs to a file instead of terminal buffer Yes, written the logs to a file. Let's see if that helps. No such errors found as of now.
Have you checked the logs in elasticsearch? Found hits at 18:28
Sent Alerts on 18:30
Time taken is
5 seconds it not too unreasonable. If that's the highest you see, then there is another cause for your 20+ delays. You'd need to share your full rule if you want extra assistance.
@Qmando
I have a similar issue in production environment where elastalert is showing a long value in time_taken of elastalert_status_status index. This happens intermittenly for a continuous timeframe during certain times in a day which is troubling my client since eventually real time alerts are delayed. I have been trying to find Root cause for the delay introduced at elastalert but no luck since it is intermittent. Please find a sample document from prod for your help.
@timestamp: 2021-02-18T07:45:16.048284Z _id: SZkZtHcBUW6Vb-ZGp3YW _index: elastalert_status_status _type: _doc endtime: 2021-02-18T06:03:42.463717Z hits: 407 matches: 34 num_hits: 3 num_matches: 1 rule_name: Shop - Severity - Minor [400 TO 499] And Not [401,403,424] starttime: 2021-02-18T05:38:43.224775Z time_taken: 6093.584537982941
Is time_taken the exact time for elastalert to only query elasticsearch? We have millions of documents in our ES and Kibana gives faster result for the same query for time_taken is a high value.
Could please help us to get to the root of high time_taken value.
Sent Alerts on 18:30
Time taken is
