Skip to content
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

Allow rollover alias to use reference like agent.version or agent.name #12285

Merged
merged 4 commits into from
Jul 26, 2019

Conversation

ph
Copy link
Contributor

@ph ph commented May 24, 2019

Previously you were not able to defined fields in the roll over alias,
this commit allow to use some of the global values. We also update the
docs to remove the prefix part.

Fixes #12233

@ph ph added the review label May 24, 2019
@ph ph requested a review from simitt May 24, 2019 19:08
@ph ph requested a review from a team as a code owner May 24, 2019 19:08
@ph
Copy link
Contributor Author

ph commented May 24, 2019

@simitt I think this bug is a hard place, if we make auto append of the version for the rollover alias we are a risk of breaking existing configuration, instead I've decided to allow the rollover_alias to use field reference. Also I think its less surprising if we do not append any version.

And WDYT about backporting it down to 7.0?

@ph ph added the libbeat label May 24, 2019
Copy link
Contributor

@simitt simitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think this makes sense. But IIRC it was an explicit decision to always prepend the version to the alias instead, and only let a prefix be configured. Not a 100% sure though, maybe @ruflin knows more about it.

libbeat/idxmgmt/ilm/ilm_test.go Outdated Show resolved Hide resolved
@simitt simitt assigned ph and unassigned simitt May 25, 2019
@ruflin
Copy link
Contributor

ruflin commented May 27, 2019

It was not implemented on purpose initially. I think historically we allowed too much flexibility in the index patterns used which caused issues like no template used, dashboard does not show the data etc. Moving forward we should be more strict on what we allow.

I would like to learn more on what the use case here is that this solves. Seems in #12233 the goal was to get almost the same behaviour as the default?

@ph
Copy link
Contributor Author

ph commented May 27, 2019

It was not implemented on purpose initially. I think historically we allowed too much flexibility in the index patterns used which caused issues like no template used, dashboard does not show the data etc. Moving forward we should be more strict on what we allow.

I do understand we want to move to a more strict system, flexibility isn't easy to deal with when you try to give a nice user experience (and uniform experience) but also I do understand that in some case allowing people to override options is a good things.

I would like to learn more on what the use case here is that this solves. Seems in #12233 the goal was to
Get almost the same behaviour as the default?

Yes, my point is more if you do override de defaults you are more on the path to choose your own adventure. So in that case I though it made more sense to not auto append the version to the alias name, but still allow user to get it by using field reference.

@ruflin
Copy link
Contributor

ruflin commented May 27, 2019

During the migration from 5 to 6 and 6 to 7 or upgrades in minors were often caused by users not having the version inside. So I'm very hesitant to allow this again. If a user wants to go on his own adventure and not have versioning, the old indexing scheme could be used and ILM alias have to be set up manually. With this any flexibility is possible and using any field in the index name is possible.

Perhaps @fpompermaier can chime to describe his use case a bit more?

@fpompermaier
Copy link

Actually I don't have any use case, I was just playing around with variables and I discovered that the documentation is wrong

@ph
Copy link
Contributor Author

ph commented May 27, 2019

@ruflin The things is they can still decide to not have the version in the index name, no?

@ruflin
Copy link
Contributor

ruflin commented May 28, 2019

Yes, I think so, but not convinced it's a good thing ;-) As you see I'm on the fence here so if you think this should go in, please move forward.

@mattapperson
Copy link

I agree with this PRs take on fixing this issue

@ph ph requested a review from urso June 17, 2019 23:51
@ph
Copy link
Contributor Author

ph commented Jun 17, 2019

@urso WDYT?

@ph
Copy link
Contributor Author

ph commented Jul 15, 2019

ping @urso urso

@urso
Copy link

urso commented Jul 24, 2019

I agree on having this change and add support for %{[agent.version]}. The default value is the same and still versioned. But without this fix, users can not version their names if they have a customized setup.

To me this change doesn't really change anything in how flexible users can configure beats.

No matter if we're strict or not, it should be consistent. There are a many resources that need to be configured when preparing an index. This requires a number of settings to be applied consistently. The more 'severe' issue is that we have a number of related settings, which need to be configured independently, but in a consistent manner instead of relying on a common set of settings.

return fmt.Errorf("rollover_alias must be set when ILM is not disabled")
}
return nil
}

func defaultConfig(info beat.Info) Config {
name := fmt.Sprintf("%s-%s", info.Beat, info.Version)
const name = "%{[beat.name]}-%{[beat.version]}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think beat.name can be overwritten using the name setting. Also beat.version is deprecated and should be agent.version.

Proposal: name := info.Beat + "-%{[agent.version]}"

ph added 3 commits July 24, 2019 10:55
Previously you were not able to defined fields in the roll over alias,
this commit allow to use some of the global values. We also update the
docs to remove the prefix part.

Fixes elastic#12233
@ph ph force-pushed the fix/fix-ilm-rollover-alias branch from 7d3a704 to b087738 Compare July 24, 2019 14:59
@ph
Copy link
Contributor Author

ph commented Jul 24, 2019

@urso I've made the change can you take another look?

libbeat/idxmgmt/ilm/config.go Outdated Show resolved Hide resolved
@ph
Copy link
Contributor Author

ph commented Jul 25, 2019

jenkins test this please

@urso
Copy link

urso commented Jul 25, 2019

Jenkins, test this.

@ph
Copy link
Contributor Author

ph commented Jul 26, 2019

unrelated issue

@ph ph merged commit 8d95484 into elastic:master Jul 26, 2019
@fwkz
Copy link

fwkz commented Aug 26, 2019

@ph Any idea when it's going to be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filebeat: variables not expanded in rollover_alias
7 participants