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
Added support for aliases to index templates #5180
Conversation
I like it!. I think we miss one use case, where the index name is Also, are we good with |
We already use
I'm not understanding this use case. Typically alias names are kinda hard coded, eg I suppose you could have something like
So the presence of the The other thing I'm missing is the ability to automatically remove older indices from aliases, eg the |
With query templates now in place, how about we move all our placeholders to mustache syntax (ie. |
@clintongormley actually, most of the cases for aliases in LS was not around "last-3-months", since Kibana solves it easily thought the main interaction that people have with it. What people were after was using aliases as a way to filter data, in which case, using the same alias created that follows the naming rules as the index name, but with a filter. |
@kimchy +1 to the use case you describe; kibana indeed solves the "last-N-months" problem. Templated aliases helps logstash (or any time-oriented indexing name) users get filtered aliases. In the past, we've given some hand-wavey answer "Well just set up a cron job to create aliases every day!" and that answer was lame. This feature is sweeeet. |
I agree some users might ask for this, but I'm not totally sure it's needed. The difference between |
In a previous life, my department was subject to regular audits of the garden variety (SOX, PCI, SOC, etc). As such, I often find myself wondering if monthly/yearly aliases would have provided more operational effectiveness during audit season. I begin to imagine a wonderful fantasy land where I simply run (or even cron) a custom script that queries the desired subset of logs via an alias, and outputs a report that is in the format the auditor desires. It's great - people are cheering, audits practically run themselves, and everything is magical. Then, I wake up. I realize that every audit I went through during that time ended in precisely the same way - the auditor staring over my shoulder as I show them the log visualization tool's interface with the query I promise him or her is accurate for their question. Eventually the auditor says, "Thank you, now please e-mail me the full screenshot of this". I tried many times, but never succeeded, in getting them to accept other, more easily automatable formats. As such, I'm on the fence about the "last-N-months" problem - I see a theoretical value to it, but I myself have never worked in an environment where that theoretical value would be realized or preferred to what Kibana provides. Likewise, if you're already writing a custom script for such a report, it would not be much more effort to automate the generation of the index list (though I don't know if you'd risk overflowing the max URI length at some point). All in all, I'm +1 to the feature in general (adding filtered aliases via mapping is something I've been longing for for a while now), and have no real strong opinion on the "last-N-months/last-year" use case - especially when I consider the amount of resources such a query would be likely to consume. |
Thanks for your comments guys, seems like we are on the right track here. Currently the alias name needs to contain the whole index name, and it seems to me that adding the ability to use only a part of it wouldn't buy much compared to how it would complicate the syntax. I lean towards keeping things simple for now, unless we find a magic syntax other than regexes :) |
If we find such a magic syntax, I would love to purge regexes from my life entirely ;) |
code looks great! |
Our use case is similar to this -- we have versioned indices named per month (e.g. Currently, we have a cron job that checks periodically to see if any new indices have been created that need additional aliases, but obviously this is a bit hacky. Am I missing an obvious alternative method, or is this really not a common approach? |
Adapted existing PR (elastic#2739) to updated code (post elastic#4920), added tests and docs (@javanna) Closes elastic#1825
Hi @stevencdavis, it is a common approach, the problem here is finding the right syntax to be able to use partial indices names as part of alias names. We'll get this PR merged as it seems to be a good start and give these other requirements some more thoughts, we can always improve this later on. |
Merged, thanks a lot @jbrook ! |
Hey.. Is there any changes in this after this PR? |
This PR finalizes the work that has been done in #2739 towards adding support for aliases to index templates.
Aliases can now be specified when creating an index template as follows:
The
{index}
placeholder within the alias name will be replaced with the actual index name that the template gets applied to during index creation.Closes #1825