opensearch-project / security-analytics

Security Analytics enables users for detecting security threats on their security event log data. It will also allow them to modify/tailor the pre-packaged solution.
Apache License 2.0
72 stars 74 forks source link

[BUG] Refactor GetAlerts API to not throw 404 NOT_FOUND errors #872

Open AWSHurneyt opened 9 months ago

AWSHurneyt commented 9 months ago

What is the bug? The GetAlerts API throws a 404 NOT_FOUND error when there are no detectors for the specified detectorType. https://github.com/opensearch-project/security-analytics/blob/main/src/main/java/org/opensearch/securityanalytics/transport/TransportGetAlertsAction.java#L126

This can cause a built-up of 4xx errors on clusters that make regular/repeated calls to that API.

What is the expected behavior? Rather than throw an error, the GetAlerts API could be refactored to instead return an empty list when there are no detectors defined for the specified detectorType.

shanjare2002 commented 9 months ago

Hey can I do this

AWSHurneyt commented 9 months ago

@shanjare2002 Sure! Feel free to raise a PR.

eirsep commented 8 months ago

@shanjare2002 are you fixing this?

ishag4 commented 1 week ago

Hi @AWSHurneyt @eirsep If this is still pending. I would like to contribute, you can assign me.

AWSHurneyt commented 4 days ago

Hi @ishag4! Yes, this is still a pending item. I've assigned you to this issue. Thank you for helping out!