-
Notifications
You must be signed in to change notification settings - Fork 491
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
Concrete ls index name #1013
Concrete ls index name #1013
Conversation
@@ -122,6 +122,12 @@ func (e *LogstashElasticHosts) GenIndices(r *LogstashRequest) (string, error) { | |||
if err != nil { | |||
return "", err | |||
} | |||
// Short-circut when using concrete ES index name | |||
if len(r.IndexRoot) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the line below can be reduced to if strings.HasSuffix(r.IndexRoot, "/")
.
@mjibson, (as I'm new to GO) Should I reduce it? |
Yes, you should. But I'm a bit confused about the intended behavior. That will test if just the last character is a "/", not if the entire string has value "/". Which do you want? |
As you can see in #974 , the intended behavior is to enable the user to signal Bosun 'just use this index name and don't add date suffix'. The context behind this is that ES indices 'costs' quite a lot in terms of memory and cpu. there are use-cases such as the one that initiated this PR that the size of data is <5MB per day so there is no reason to create new indices every day. also there's the fact that olivere/elastic client (that Bosun is using to interact with ES) query's indices by index name, and doesn't include index aliases (which you can think of sym-links from 'myindex-2015.05.31' to 'myindex-global'). Will the 'strings.HasSuffix(r.IndexRoot, "/")' will handle Hope that the above is clear enoungh, |
Strings can't be nil, but they can be empty, and HasSuffix handles that correctly. |
@kylebrandt, could you review this? |
+1 |
Tested '/' functionality as concrete ES index name signaling (without Bosun adding date suffix), works great.