Skip to content

Commit c81adcc

Browse files
authored
Build config files with Go text/template (#18148)
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).
1 parent 64f6e80 commit c81adcc

138 files changed

Lines changed: 2386 additions & 2335 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG-developer.next.asciidoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
4141
- Rename `queue.BufferConfig.Events` to `queue.BufferConfig.MaxEvents`. {pull}17622[17622]
4242
- Remove `queue.Feature` and replace `queue.RegisterType` with `queue.RegisterQueueType`. {pull}17666[17666]
4343
- Introduce APM libbeat instrumentation. `Publish` method on `Client` interface now takes a Context as first argument. {pull}17938[17938]
44+
- The way configuration files are generated has changed to make it easier to customize parts
45+
of the config without requiring changes to libbeat config templates. Generation is now
46+
fully based on Go text/template and no longer uses file concatenation to generate the config.
47+
Your magefile.go will require a change to adapt the devtool API. See the pull request for
48+
more details. {pull}18148[18148]
4449

4550
==== Bugfixes
4651

auditbeat/_meta/common.reference.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{header "Config Reloading"}}
2+
3+
# Config reloading allows to dynamically load modules. Each file which is
4+
# monitored must contain one or multiple modules as a list.
5+
auditbeat.config.modules:
6+
7+
# Glob pattern for configuration reloading
8+
path: ${path.config}/modules.d/*.yml
9+
10+
# Period on which files under path should be checked for changes
11+
reload.period: 10s
12+
13+
# Set to true to enable config reloading
14+
reload.enabled: false
15+
16+
# Maximum amount of time to randomly delay the start of a dataset. Use 0 to
17+
# disable startup delay.
18+
auditbeat.max_start_delay: 10s
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{{header "Modules configuration"}}
2+
auditbeat.modules:
File renamed without changes.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{template "header.reference.yml.tmpl" .}}
2+
{{template "auditbeat.config.modules.yml.tmpl" .}}
3+
{{template "auditbeat.modules.yml.tmpl" .}}
4+
{{template "config.modules.yml.tmpl" .}}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{template "header.yml.tmpl" .}}
2+
{{template "auditbeat.modules.yml.tmpl" .}}
3+
{{template "config.modules.yml.tmpl" .}}
4+
{{template "setup.template.yml.tmpl" .}}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
########################## Auditbeat Configuration #############################
2+
3+
# This is a reference configuration file documenting all non-deprecated options
4+
# in comments. For a shorter configuration example that contains only the most
5+
# common options, please see auditbeat.yml in the same directory.
6+
#
7+
# You can find the full configuration reference here:
8+
# https://www.elastic.co/guide/en/beats/auditbeat/index.html
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,3 @@
66
#
77
# You can find the full configuration reference here:
88
# https://www.elastic.co/guide/en/beats/auditbeat/index.html
9-
10-
#========================== Modules configuration =============================
11-
auditbeat.modules:
12-
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{header "Elasticsearch template setting"}}
2+
setup.template.settings:
3+
index.number_of_shards: 1
4+
#index.codec: best_compression
5+
#_source.enabled: false

0 commit comments

Comments
 (0)