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

"Failed to parse query" for blacklist rule when file contains more than 1024 entries #2704

Open
tfriesen opened this issue Mar 5, 2020 · 2 comments

Comments

@tfriesen
Copy link

tfriesen commented Mar 5, 2020

When trying to create a blacklist rule that parses a file that contains more than 1024 lines, I get the following error:

elastalert_error - {'message': 'Error running query: [\'Failed to parse query [winlog.event_data.md5:"65a27335241f56963655d472704cae8e" OR .... winlog.event_data.md5:"cf85c2ced0556ce7... (60500 characters removed)', 'traceback': ['Traceback (most recent call last):', ' File "/usr/local/lib/python3.6/site-packages/elastalert/elastalert.py", line 398, in get_hits', ' raise ElasticsearchException(errs)', 'elasticsearch.exceptions.ElasticsearchException: [\'Failed to parse query [winlog.event_data.md5:"65a2...

To reproduce:

  1. Create a blacklist rule (probably works with other rules) that reads a file for blacklist terms
  2. enter more than 1024 items into the blacklist file
  3. Attempt to test rule via elastalert-test-rule --config config.yaml myrule.yaml

Is this a limitaiton with elastalert, or with one of the frameworks it depends on, or with Elasticsearch, or...?

@tfriesen
Copy link
Author

tfriesen commented Mar 5, 2020

Turns out it's a (default) limitation in ElasticSearch, the indices.query.bool.max_clause_count term. Increasing this would fix my problem, but is not recommended.

Best solution would be to rejigger the get_query() or enhance_filter() function to break up queries with more 1024 terms into multiple queries. Or maybe make a LongBlacklist rule class.

@rayaar
Copy link

rayaar commented Jun 26, 2020

Yes. Having the same issue with large blacklists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants