Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cmd/bosun/expr/logstash.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

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, "/").

if r.IndexRoot[len(r.IndexRoot)-1] == '/' {
return r.IndexRoot[:len(r.IndexRoot)-1], nil
}
}
indices, err := lsClient.IndexNames()
if err != nil {
return "", err
Expand Down