Comments (7)
Hi @astik,
I didn't test it, but you should be able to define your ILM policy in beat_conf
variable using Configure index lifecycle management doc:
beat_conf:
...
setup.ilm.enabled: auto
setup.ilm.rollover_alias: "filebeat"
setup.ilm.pattern: "{now/d}-000001"
from ansible-beats.
Yes i am =)
I already work on the naive solution past week-end.
Still a WIP as it needs better polishing.
from ansible-beats.
Simple as that !
I can't test it for now, but it looks aligned with what the role will do.
Thanks for the info.
from ansible-beats.
Follow up on this ticket:
- by default, with version 7.6, beat will use respective policy name:
- ilm definition from beat installation does not allow policy definition
- ilm policy definition should be elasticsearch responsability, not beats
- still, ilm policy for beats index is initialized by beat first run with a default policy, wo it may be beat's responsabilty after all for the default one
Default ILM policy are:
filebeat export ilm-policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "30d",
"max_size": "50gb"
}
}
}
}
}
}
metricbeat export ilm-policy
{
"policy": {
"phases": {
"hot": {
"actions": {
"rollover": {
"max_age": "30d",
"max_size": "50gb"
}
}
}
}
}
}
- beat allow the definition of a non existing policy through the use of settings setup.ilm.policy_file (https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html#setup-ilm-policy_file-option and https://www.elastic.co/guide/en/beats/filebeat/current/ilm.html#setup-ilm-policy_file-option)
- then we could choose to overwrite default policy with the new one through the settings setup.ilm.overwrite (https://www.elastic.co/guide/en/beats/metricbeat/current/ilm.html#setup-ilm-overwrite-option and https://www.elastic.co/guide/en/beats/filebeat/current/ilm.html#setup-ilm-overwrite-option)
any chance to be able, from beat ansible role, to define default ILM policy that is created if none already exist ?
As the beat configuration is expecting a file path, we would need a way to create default policy json configuration file in the ansible-beat role
@jmlrt what do you think of that approach?
from ansible-beats.
FWIW, here is the change i had done to make it work:
- my playbook conf:
- role: elastic.beats
beat: metricbeat
beat_conf:
setup:
dashboards.enabled: true
ilm:
policy_file: /etc/metricbeat/policies/my-metricbeat.json
overwrite: true
metricbeat.modules:
- module: system
metricsets:
- cpu
- load
- ...
enabled: true
period: 10s
processes:
- ".*"
default_ilm_policy: conf/elasticsearch/ilm-policies/my-metricbeat.json
(notice the setup.ilm.policy_file and setup.ilm.overwrite in beat_conf (standard stuff) and the default_ilm_policy parameter (new stuff).
- additions at the end of beats-config.yml:
# Copy default ILM policy file
- name: Create default policies config directory
file:
path: "{{ beats_conf_dir }}/policies"
state: directory
when: default_ilm_policy is defined
- name: Copy default ILM policy file for {{ beat }}
copy:
src: "{{default_ilm_policy}}"
dest: "{{ beats_conf_dir }}/policies/{{default_ilm_policy | basename}}"
when: default_ilm_policy is defined
notify: restart the service
we create a new folder to store default policy (/etc/metricbeat/policies), then we copy our policy to this folder (/etc/metricbeat/policies/my-metricbeat.json).
This is a very naïve approach. It would be better not to have to set up setup.ilm.policy_file and have it automatically set up when default_ilm_policy is defined.
from ansible-beats.
Hi @astik, that make sense.
Being able to copy a file and setup its path in the config file is something that we already do for TLS certs in ansible-elasticsearch (see elastic/ansible-elasticsearch@d7efa20).
Would you be interested to make a pull request for that?
from ansible-beats.
fixed by #78
from ansible-beats.
Related Issues (20)
- Add support for CentOS / RHEL 8.x
- Copy default ILM policy file: Destination /etc/filebeat not writable HOT 2
- Mismatch between release name v7.10.1 and version 7.10.1 HOT 2
- Beats keystore support HOT 8
- "use_repository: false" - Default URL Broken HOT 8
- elastic.beats was NOT installed successfully: Unable to compare role versions HOT 1
- And Elastic username and password for all beats HOT 1
- `beat_conf.setup.ilm.policy_file` must be specified HOT 5
- apt-mark unhold fails HOT 1
- Debian 11 HOT 2
- artifacts.elastic.co repo issues HOT 1
- Escape multiline.pattern HOT 1
- Change mode of config file away from 644
- Add journalbeat tests/support HOT 5
- configuration per host HOT 3
- Error during "unhold filebeat version for install" HOT 8
- Filebeat can't start, with default /etc/default/filebeat file on OS without systemd HOT 4
- conditionals in output config HOT 3
- Enable metricbeat docker module HOT 2
- Windows support HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-beats.