One way to achieve this is to rotate your index every day and keep the maximum number of indexes to 8. This way you will always have a whole week + the current day of the logs in your Elasticsearch cluster.
elasticsearch_max_time_per_index = 1d
elasticsearch_max_number_of_indices = 8
Please note that search performance can be even better if you use more index and shorter rotation time thanks to the Graylog smart timing feature. For example, this should lead to faster search results if you have a lot of data:
elasticsearch_max_time_per_index = 12h
elasticsearch_max_number_of_indices = 16
you can even reduce the number of indexes to 15 and have a whole week of data.
source
share