Hello graylog community,
this time I have tricky question.
I am running several index templates like “logs_r01m”, “logs_r06m”, “logs_r12m”.
All of these index templates use time-based rotation and were created at the same time, so their current write indices points to logs_r01m_736, logs_r06m_736 and logs_r12m_736 respectively.
Now I need to create a new index set “logs_r03m” for a 3M retention period, but I’d like to keep its numbering synchronized. Is there a comfortable way to get its current write index to point to logs_r03m_736?
I know I can press “index maintenance > rotate active write index” 736 times, but that is hardly comfortable and will get only worse.
(Note Elasticsearch for Graylog should stay at version 7.10 for now…)
On the Elastic side you can create/re-index to the name you want - the trick is getting Graylog to see it. I think you can use the index maintenance to recalculate the index range but I haven’t specifically done that…
@tmacgbay Thank you for trying to help.
I want to start a new empty index set and I want Graylog to skip creating “logs_r03m_0”," logs_r03m_1", etc. all the way to “logs_r03m_735” and start the index set at logs_r03m_736.
I don’t have any data that would go into this index yet, so I don’t see how reindexing could help. “Recalculating index ranges” works on individual indices and recalculates their timestamp ranges, not index names.
The re-index is essentially a copy command. Create the new index, the copy (or as elastic search calls it “re-index”) from your initial name to the one you want. Delete the old index via elastic or via Graylog.
Sure, I can copy (empty) “logs_r03m_0” to “logs_r03m_736” and delete the original. That is the easy part.
But Graylog will not know about this and complain “logs_r03m_0” does not exist. Then I could click “index maintenance > rotate active write index”, but that will create “logs_r03m_1” and point write index there, right?
I don’t want to spend whole day clicking “index maintenance > rotate active write index” 735 times.
To get the active index right, you could re-index to one lower than you want, delete all others, then once you restart graylog, rotate the index once….
You are working with a blank slate, give it a try!
in Graylog create index set logs_r03m so elastic would have logs_r03m_0
in Elastic create index set logs_r03m_736 - see curl call above
Graylog automatically switches to the new index and starts writing to it
Finished! You can remove the _0 version if you want… or you can let retention policy do it.
Or, just to be on the safe side, create logs_r03m_735 and then rotate active write index.
That way logs_r03m_736 will be guaranteed to be created exactly as Graylog wants it.
PS: It even works the other way. If I delete logs_r03m_736, graylog automatically switches to logs_r03m_0 and starts writing there (NOT RECOMMENDED!). That explain why simply rotating write index was enough for fixing Need to clear elastic search after upgrade to version 4