Count "active" messages

I have a log source that sends an event when an alert is triggered event.type: "Alert Started". Another event is triggered when the alert clears event.type: "Alert Ended"

I'm looking to know how best I can retrieve a count of "active" alerts. i.e. number of alerts that has yet to receive an Alert Ended event.

Any ideas?

Cheers!

You might be able to send the "Alert Started" events straight through, then use an aggregate filter to match up the start and end events. If you set the document_id (I am assuming you are writing to elasticsearch) you can overwrite the document once it has ended. Then in elasticsearch you can query the number of alerts that have not ended.