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

Refactor index management #10347

Merged
merged 57 commits into from
Jan 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
25d41af
start
Jan 23, 2019
0c22845
in progress
Jan 24, 2019
7ac25ff
Introduce idxsupport
Jan 25, 2019
3773262
Update export/setup commands
Jan 25, 2019
3b2e6dc
start output
Jan 25, 2019
a897dfb
Pass index manager to outputs
Jan 26, 2019
8e37b5b
move libbeat/ilm to libbeat/idxmgmt/ilm
Jan 26, 2019
6c117b0
Create constructor
Jan 26, 2019
c0c09c6
Fully configurable index management
Jan 26, 2019
83564f1
fix pipeline/stress package
Jan 26, 2019
40da9ef
Do not reference outputs/elasticsearch package from idxmgmt package
Jan 26, 2019
dad6b8c
Fix ES unit tests
Jan 26, 2019
fc0a5a9
Fix nil config
Jan 26, 2019
8bb23c0
fix logstash test
Jan 26, 2019
2201982
fix template tests
Jan 26, 2019
dab6a4f
Add idxmgmt support to init from nil
Jan 26, 2019
85b5e82
compile output integration tests
Jan 26, 2019
7eed081
reenable output command
Jan 26, 2019
8aa0a95
pass logger
Jan 26, 2019
2ef256e
Create index manager for es client in ls test
Jan 26, 2019
2915ae6
fix nil
Jan 26, 2019
7b3e776
Fix alias pattern
Jan 26, 2019
8712615
golint
Jan 26, 2019
24f0f50
Add support to configure the ilm policy in system tests
Jan 26, 2019
4561cba
update ilm settings in libbeats test_ilm.py
Jan 26, 2019
ec47f82
more godoc
Jan 26, 2019
98931c4
fix typo
Jan 26, 2019
5212b2c
Restore old log message text (make system tests happy)
Jan 26, 2019
77eb919
Allow filebeat tests to configure ilm
Jan 26, 2019
79d449c
Disable ILM in filebeat module tests
Jan 26, 2019
6163274
Disable ILM in pipeline test
Jan 26, 2019
6077ba0
export template uses settings.IndexManager now
Jan 28, 2019
ec9dfe9
simplify IndexSupporter interface and introduce Asseter
Jan 28, 2019
d77192f
Update config files
Jan 28, 2019
c9972f8
Do not fail if alias already exists
Jan 28, 2019
8ce52a7
Add ilm APIHandler test with elasticsearch
Jan 28, 2019
f35e884
fix typo in setting name
Jan 28, 2019
1e13373
return error if ilm is required, but not available
Jan 28, 2019
20ffaa6
ilm package unit tests
Jan 28, 2019
01a1968
rename
Jan 28, 2019
091c786
godoc
Jan 28, 2019
6da146b
with withILM parameter
Jan 28, 2019
208d8d6
mock ilm support for idxmgmt testing
Jan 28, 2019
fd750df
init idxmgmt test
Jan 28, 2019
42dc1e3
fix goimports version
Jan 28, 2019
b8869ab
Test event index selection
Jan 28, 2019
dbf2acc
changelog
Jan 28, 2019
e752dec
review
Jan 29, 2019
b57cc45
Replace TemplateSettings with Alias and Policy types
Jan 29, 2019
3eced98
fix rebase
Jan 29, 2019
2da4f67
rename setup.ilm.name to setup.ilm.policy_name
Jan 29, 2019
2760ab0
move template + es output config check to index supporter
Jan 30, 2019
ff3f66e
pass default index name to BuildSelector
Jan 30, 2019
b7c0aa7
Update tests
Jan 30, 2019
5dbe4c1
Move default index name creation to indexSupport
Jan 30, 2019
99cba1d
ups
Jan 30, 2019
8c29608
fix rebase
Jan 31, 2019
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
4 changes: 4 additions & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2..master[Check the HEAD di
The list below covers the major changes between 7.0.0-alpha2 and master only.

==== Breaking changes
- Outputs receive Index Manager as additional parameter. The index manager can
be used to create an index selector. {pull}10347[10347]

==== Bugfixes

Expand All @@ -27,3 +29,5 @@ The list below covers the major changes between 7.0.0-alpha2 and master only.
- Allow multiple object type configurations per field. {pull}9772[9772]
- Move agent metadata addition to a processor. {pull}9952[9952]
- Add (*common.Config).Has and (*common.Config).Remove. {pull}10363[10363]
- Introduce ILM and IndexManagment support to beat.Settings. {pull}10347[10347]
urso marked this conversation as resolved.
Show resolved Hide resolved
- Introduce ILM and IndexManagement support to beat.Settings. {pull}10347[10347]
5 changes: 5 additions & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Remove --setup command line flag. {pull}10138[10138]
- Remove --version command line flag. {pull}10138[10138]
- Remove --configtest command line flag. {pull}10138[10138]
- Move output.elasticsearch.ilm settings to setup.ilm. {pull}10347[10347]
- ILM will be available by default if Elasticsearch > 7.0 is used. {pull}10347[10347]
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens for the OSS users? Should this be >= 7?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, auto is default and not true ... I assume this does the trick.

Copy link
Author

Choose a reason for hiding this comment

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

yep, auto does the trick.


*Auditbeat*

Expand Down Expand Up @@ -187,6 +189,9 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Add `add_fields` processor. {pull}10119[10119]
- Add Kibana field formatter to bytes fields. {pull}10184[10184]
- Document a few more `auditd.log.*` fields. {pull}10192[10192]
- Add ILM mode `auto` to setup.ilm.enabled setting. This new default value detects if ILM is available {pull}10347[10347]
- Add support to read ILM policy from external JSON file. {pull}10347[10347]
- Add `overwrite` and `check_exists` settings to ILM support. {pull}10347[10347]

*Auditbeat*

Expand Down
24 changes: 19 additions & 5 deletions auditbeat/auditbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,6 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false
#ilm.rollover_alias: "auditbeat"
#ilm.pattern: "{now/d}-000001"

# Set gzip compression level.
#compression_level: 0

Expand Down Expand Up @@ -1009,6 +1004,25 @@ setup.template.settings:
#_source:
#enabled: false

#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.

# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.
#setup.ilm.enabled: auto

# Configure the ILM write alias name.
#setup.ilm.rollover_alias: "auditbeat"

# Configure rollover index pattern.
#setup.ilm.pattern: "{now/d}-000001"


#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
Expand Down
3 changes: 0 additions & 3 deletions auditbeat/auditbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
Expand Down
24 changes: 19 additions & 5 deletions filebeat/filebeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1059,11 +1059,6 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false
#ilm.rollover_alias: "filebeat"
#ilm.pattern: "{now/d}-000001"

# Set gzip compression level.
#compression_level: 0

Expand Down Expand Up @@ -1710,6 +1705,25 @@ setup.template.settings:
#_source:
#enabled: false

#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.

# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.
#setup.ilm.enabled: auto

# Configure the ILM write alias name.
#setup.ilm.rollover_alias: "filebeat"

# Configure rollover index pattern.
#setup.ilm.pattern: "{now/d}-000001"


#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
Expand Down
3 changes: 0 additions & 3 deletions filebeat/filebeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
Expand Down
13 changes: 13 additions & 0 deletions filebeat/tests/system/config/filebeat.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,19 @@ filebeat.config.{{ reload_type|default("inputs") }}:
{% endif -%}
{% endif -%}

{% if ilm %}
setup.ilm:
enabled: {{ ilm.enabled | default("auto") }}
policy_name: libbeat-test-default-policy
{% if ilm.pattern %}
pattern: {{ ilm.pattern }}
{% endif %}
{% if ilm.rollover_alias %}
rollover_alias: {{ ilm.rollover_alias }}
{% endif %}
{% endif %}


#============================== Autodiscover ==================================

{% if autodiscover %}
Expand Down
13 changes: 13 additions & 0 deletions filebeat/tests/system/config/filebeat_inputs.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ filebeat.inputs:
{% endfor %}
filebeat.registry_file: {{ beat.working_dir + '/' }}{{ registryFile|default("registry")}}

{% if ilm %}
setup.ilm:
enabled: {{ ilm.enabled | default("auto") }}
policy_name: libbeat-test-default-policy
{% if ilm.pattern %}
pattern: {{ ilm.pattern }}
{% endif %}
{% if ilm.rollover_alias %}
rollover_alias: {{ ilm.rollover_alias }}
{% endif %}
{% endif %}


output.file:
path: {{ output_file_path|default(beat.working_dir + "/output") }}
filename: "{{ output_file_filename|default("filebeat") }}"
Expand Down
13 changes: 13 additions & 0 deletions filebeat/tests/system/config/filebeat_modules.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,16 @@ setup.kibana.host: {{ kibana_url }}
{% if kibana_path %}
setup.dashboards.directory: {{ kibana_path }}
{% endif %}

{% if ilm %}
setup.ilm:
enabled: {{ ilm.enabled | default("auto") }}
policy_name: libbeat-test-default-policy
{% if ilm.pattern %}
pattern: {{ ilm.pattern }}
{% endif %}
{% if ilm.rollover_alias %}
rollover_alias: {{ ilm.rollover_alias }}
{% endif %}
{% endif %}

3 changes: 2 additions & 1 deletion filebeat/tests/system/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_fileset_file(self, module, fileset, test_file):
template_name="filebeat_modules",
output=cfgfile,
index_name=self.index_name,
elasticsearch_url=self.elasticsearch_url
elasticsearch_url=self.elasticsearch_url,
)

self.run_on_file(
Expand All @@ -111,6 +111,7 @@ def run_on_file(self, module, fileset, test_file, cfgfile):
self.filebeat, "-systemTest",
"-e", "-d", "*", "-once",
"-c", cfgfile,
"-E", "setup.ilm.enabled=false",
"-modules={}".format(module),
"-M", "{module}.*.enabled=false".format(module=module),
"-M", "{module}.{fileset}.enabled=true".format(
Expand Down
1 change: 1 addition & 0 deletions filebeat/tests/system/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def test_input_pipeline_config(self):
pipeline="test",
setup_template_name=index_name,
setup_template_pattern=index_name + "*",
ilm={"enabled": False},
)

os.mkdir(self.working_dir + "/log/")
Expand Down
24 changes: 19 additions & 5 deletions heartbeat/heartbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,6 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false
#ilm.rollover_alias: "heartbeat"
#ilm.pattern: "{now/d}-000001"

# Set gzip compression level.
#compression_level: 0

Expand Down Expand Up @@ -1153,6 +1148,25 @@ setup.template.settings:
#_source:
#enabled: false

#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.

# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.
#setup.ilm.enabled: auto

# Configure the ILM write alias name.
#setup.ilm.rollover_alias: "heartbeat"

# Configure rollover index pattern.
#setup.ilm.pattern: "{now/d}-000001"


#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
Expand Down
3 changes: 0 additions & 3 deletions heartbeat/heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
Expand Down
24 changes: 19 additions & 5 deletions journalbeat/journalbeat.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false
#ilm.rollover_alias: "journalbeat"
#ilm.pattern: "{now/d}-000001"

# Set gzip compression level.
#compression_level: 0

Expand Down Expand Up @@ -943,6 +938,25 @@ setup.template.settings:
#_source:
#enabled: false

#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.

# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.
#setup.ilm.enabled: auto

# Configure the ILM write alias name.
#setup.ilm.rollover_alias: "journalbeat"

# Configure rollover index pattern.
#setup.ilm.pattern: "{now/d}-000001"


#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
Expand Down
3 changes: 0 additions & 3 deletions journalbeat/journalbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
Expand Down
24 changes: 19 additions & 5 deletions libbeat/_meta/config.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,6 @@ output.elasticsearch:
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false
#ilm.rollover_alias: "beat-index-prefix"
#ilm.pattern: "{now/d}-000001"

# Set gzip compression level.
#compression_level: 0

Expand Down Expand Up @@ -897,6 +892,25 @@ setup.template.settings:
#_source:
#enabled: false

#============================== Setup ILM =====================================

# Configure Index Lifecycle Management Index Lifecycle Management creates a
# write alias and adds additional settings to the template.
# The elasticsearch.output.index setting will be replaced with the write alias
# if ILM is enabled.

# Enabled ILM support. Valid values are true, false, and auto. The beat will
# detect availabilty of Index Lifecycle Management in Elasticsearch and enable
# or disable ILM support.
#setup.ilm.enabled: auto

# Configure the ILM write alias name.
#setup.ilm.rollover_alias: "beat-index-prefix"

# Configure rollover index pattern.
#setup.ilm.pattern: "{now/d}-000001"


#============================== Kibana =====================================

# Starting with Beats version 6.0.0, the dashboards are loaded via the Kibana API.
Expand Down
3 changes: 0 additions & 3 deletions libbeat/_meta/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]

# Enabled ilm (beta) to use index lifecycle management instead daily indices.
#ilm.enabled: false

# Optional protocol and basic auth credentials.
#protocol: "https"
#username: "elastic"
Expand Down
2 changes: 1 addition & 1 deletion libbeat/cmd/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func genExportCmd(settings instance.Settings, name, idxPrefix, beatVersion strin
exportCmd.AddCommand(export.GenExportConfigCmd(settings, name, idxPrefix, beatVersion))
exportCmd.AddCommand(export.GenTemplateConfigCmd(settings, name, idxPrefix, beatVersion))
exportCmd.AddCommand(export.GenDashboardCmd(name, idxPrefix, beatVersion))
exportCmd.AddCommand(export.GenGetILMPolicyCmd())
exportCmd.AddCommand(export.GenGetILMPolicyCmd(settings, name, idxPrefix, beatVersion))

return exportCmd
}
Loading