This is an Elasticsearch soft limit and is meant to protect against what they call “mapping exploision”, “which can cause out of memory errors and difficult situations to recover from”.
This limit can be increased, but it is not recommended.
This blog post explains how to recover from this: https://graylog.org/post/what-to-do-when-you-have-1000-fields/
Unfortunately it is difficult to give helpful guidance because every environment is different and guidance is highly dependent on your log data.
In my experience there are only a handful of things that can contribute to such large number of fields:
- elastic beats
- I strongly recommend to put each type of beat in its own index set
- parsing json and setting the result as fields (taking EVERY json field and creating a corresponding json field)
- This one is less common but is something to watch out for.
Even if you split out each beat type into its own stream/index set that would still only be about 5-6 index sets, which isn’t a lot.
All our dashboards and all our alerts would have to be rewritten to search for logs across multiple indices.
Can you clarify what you mean by this? By default all of graylog’s functions (search, dashboards, alerts) work with ALL log data across all streams. Do you already have these items configured to use an explicit stream or streams?
This seems like a real scaling issue in Graylog, it doesn’t look like there is anything to help manage this issue
I understand your frustration. We do provide documentation as well as this forum. We’ve also raised the topic of index management with the product teams internally so this is definitely something we’re aware of and want to improve.
This is easy in SQL, there must be a way to do something similar in ES?
Lucene is not designed as a relational database so it functions differently. It does appear that Elasticsearch have added some metrics APIs to answer your query but they don’t exist in a version of elaticsearch that is compatible with graylog.
Lastly, if you are interested, I put together a quick python script to automate the following tasks to better help you answer your question:
- get a list of all indices
- get a list of all fields from each index
- count how many documents contain that field (using the
_count
api and using an exists
query).
See https://github.com/drewmiranda-gl/graylog-scripts/blob/main/Src/ES-OS-Count-Field-Usage/es-os-count-field-usage.py
Example usage:
python3 es-os-count-field-usage.py --api-url http://localhost:9200
Example output:
note that this will send a large amount of queries to your elasticsearch cluter, 1 query for each field for each index.
Hope this helps.