Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alerts are not getting deleted as expected #974

Closed
ag-michael opened this issue May 20, 2019 · 11 comments
Closed

Alerts are not getting deleted as expected #974

ag-michael opened this issue May 20, 2019 · 11 comments
Assignees
Milestone

Comments

@ag-michael
Copy link

Request Type

Bug

Work Environment

Question Answer
OS version (server) Redhat
OS version (client) 7.6
TheHive version / git hash 3.3.0-1
Package Type RPM
Browser type & version FireFox

Problem Description

Alert count is not dropping event after deleting alerts.
I have been using DELETE requests against the api end point /api/alert/<alert id> to remove alerts continually. However, I'm not seeing the alert count drop. This is making the TheHive much slower than it use to be and much more difficult to search alerts and cases.

Steps to Reproduce

  1. Have over 9000 alerts, attempt to DELETE them
  2. The alert count does not drop on the top banner in thehive

Complementary information

I'm using this script to automate the alert auto age-out: https://gist.github.com/ag-michael/532f94df98a761b95c167b0652ccc88c

@ag-michael
Copy link
Author

Additionally, if there is a supported way to delete all alerts or completely remove an alert, please let me know.

@nadouani
Copy link
Contributor

The alert delete API just sets the status to Ignored, it doesn't delete the document from the DB, we just do soft deletes.

If you really want to delete the document from the DB, then you need to make it on the database directly, but donc remove the alerts that have been promoted into a case.

This can be fixed by the feature that allow setting a purge date, but it's not yet planned.

@nadouani
Copy link
Contributor

I was in fact referring to your issue number #965

@ag-michael
Copy link
Author

@nadouani Can you re-open the issue, I believe you responded to my follow-up comment instead of the bug. My comment was asking about hard-deletion ,but the bug I reported is regarding the alert-count not changing.

Even for soft-deletes, the 'Alerts" count should go down when alerts are ignored. At least that is how it used to be.

@nadouani
Copy link
Contributor

Sure, it's reopened now

@nadouani nadouani reopened this May 22, 2019
@nadouani
Copy link
Contributor

Even for soft-deletes, the 'Alerts" count should go down when alerts are ignored. At least that is how it used to be.

I agree. It's supposed to work that way, when an alert is marked as Ignored

@nadouani nadouani added bug and removed question labels May 22, 2019
@ag-michael ag-michael changed the title Alerts are not getting detelted as expected Alerts are not getting deleted as expected Jun 11, 2019
@ag-michael
Copy link
Author

@nadouani Have you had a chance to revist this?

@nadouani
Copy link
Contributor

I'll give it a try for RC2

@nadouani nadouani added this to the 3.4.0-RC2 milestone Jul 4, 2019
@To-om To-om assigned nadouani and unassigned To-om Jul 5, 2019
@nadouani
Copy link
Contributor

nadouani commented Jul 8, 2019

Hi @ag-michael I wasn't able to reproduce the fact that the alert count doesn't decrease when deleting an alert.

We will also add a feature that allows hard delete of alerts using an dedicated API

@nadouani
Copy link
Contributor

nadouani commented Jul 8, 2019

We will add a /api/alert/<alert id>?force=1 to hard delete an alert by ID.

Only alerts not promoted to case will be deletable, only by admin users.

@ag-michael
Copy link
Author

Hi @ag-michael I wasn't able to reproduce the fact that the alert count doesn't decrease when deleting an alert.

We will also add a feature that allows hard delete of alerts using an dedicated API

Thank you so much for allowing deletion of alerts.

I am unsure why the alert count won't go down. It could have something to do with ES's default limit of 10K results maybe? Did you test on a large number of alerts?

Regardless, the hard deletion might fix that problem for me as well.

Developer console shows /api/alert/_stats being called for which the response below is seen:

{"count":33633,"Updated":{"count":2},"Ignored":{"count":18142},"New":{"count":15272},"Imported":{"count":217}}

I'll see if i can delete all unimported alerts once the new api function is released.

Thanks again.

To-om added a commit that referenced this issue Jul 9, 2019
@nadouani nadouani closed this as completed Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants