Alerts not firing #1029
Comments
ExistsMatch('details.sourceipaddress') means that the fields details.sourceipaddress has to exist in the json data structure (it can be any value.. but it has to be present) before it will match. So for it to match you'd have to change:
to
or remove that from the selection criteria. Hope that helps! |
Sorry, I've commented the sourceip line out. Updated code to reflect that. |
Oh, I should add that doing an aggregated search also introduces an 'exists' criteria in the search as well behind the scenes, so even if you remove it from the search_query.add_must, it'll get added back in to satisfy the aggregation here: https://github.com/mozilla/MozDef/blob/master/alerts/lib/alerttask.py#L280 |
Ahhh I see. So if I aggregate on category that should remove the exists requirement? Also do I need to restart mozdef to propagate the change? |
If you don't really care about aggregation and just want it to fire on witnessing one event you can use this pattern that the cloudtrail disabled uses: https://github.com/mozilla/MozDef/blob/master/alerts/cloudtrail_logging_disabled.py#L16 Then you'll get an alert for each event that matches. And yes if you change the code for an alert; you'd need to restart the alerts process for it to take effect. |
Current alert form is below. Also, is there a better way to restart the alerts service with the docker containers than
|
Looks ok, do you have it scheduled to run ala: As for restarting. If you are doing active development; I'd just docker exec -it <container_name> bash and do restarts from there. |
Ya I've scheduled it. Here's my full alerts schedule with some pseudoonomization
|
hrm.. lemme spin up a local docker version and see what I run into |
Cool. Is it possible that one of my alerts might have an error and somehow kill the alerting process? Edit: |
Just so I'm clear this fix would create a new yml file in Looking at docker ps it seems that my alerts container is in a reboot loop. Found a missing end quote in one of my alerts which was causing the reboot loop. Fixing this does not enable alerts for me, but I made a PR to try-except on alerts importing anyway. Edit: |
Hey all,
Maybe it's the holiday gremlins that got to me, but I've updated my docker instance to 1.35 and I can't get alerts working again. I'm down to the following very simple alert which is not working
with
in my
docker/compose/mozdef_alerts/files/config.py
. I'm sending simple messages to my instance with curlcurl -v --header "Content-Type: application/json" --request POST --data '{"tags": ["test"],"category": "helloworld"}' http://localhost:8080/events
and they are showing up in Kibana.Is there something obvious that I'm doing wrong? Also is there some way outside of the UI that lets me determine if an alert is working?
The text was updated successfully, but these errors were encountered: