-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Cherry-pick #18148 to 7.x: Build config files with Go text/template #18212
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
botelastic
bot
added
the
needs_team
Indicates that the issue/PR needs a Team:* label
label
May 4, 2020
Rather than relying on file concatenation followed by Go text/template we'll just use Go text/template. This makes is easier to customize a template without having to modify libbeat since you can just overwrite a template section (like inject your own processors section). This works by loading all of the templates from `libbeat/_meta/config/*.tmpl` followed by templates from `$mybeat/_meta/config/*.tmpl`. Files loaded last take precedence (it uses go text/template ParseGlob). Finally each template is created from `libbeat/_meta/config/default{., reference, docker}.yml.tmpl` (which can be changed if needed, see elastic/agent). (cherry picked from commit c81adcc)
andrewkroh
force-pushed
the
backport_18148_7.x
branch
from
May 4, 2020 22:17
20095e1
to
5f6eef9
Compare
andrewkroh
added
Team:SIEM
and removed
needs_team
Indicates that the issue/PR needs a Team:* label
labels
May 4, 2020
Pinging @elastic/siem (Team:SIEM) |
💔 Build FailedExpand to view the summary
Build stats
Steps errorsExpand to view the steps failures
Log outputExpand to view the last 100 lines of log output
|
run tests |
kvch
approved these changes
May 5, 2020
run tests |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #18148 to 7.x branch. Original message:
What does this PR do?
Rather than relying on file concatenation followed by Go text/template we'll just
use Go text/template. This makes is easier to customize a template without having
to modify libbeat since you can just overwrite a template section (like inject your own
processors section).
This works by loading all of the templates from
libbeat/_meta/config/*.tmpl
followedby templates from
$mybeat/_meta/config/*.tmpl
. Files loaded last take precedence(it uses go text/template ParseGlob). Finally each template is created from
libbeat/_meta/config/default{., reference, docker}.yml.tmpl
(which can be changedif needed, see elastic-agent as an example).
Why is it important?
I need to customize the default processors in the Winlogbeat configuration file and I don't want to add some special logic to the libbeat config files (see an example in https://github.com/elastic/beats/pull/18153/files#diff-5a4f08fe070667029d82636401b2aaf9R95). So with this change a Beat can more easily tailor the config to its needs.
Checklist
- [x] I have made corresponding changes to the documentation- [ ] I have added tests that prove my fix is effective or that my feature worksCHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
make update