Coder Social home page Coder Social logo

Comments (7)

jmlrt avatar jmlrt commented on August 28, 2024 2

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.

astik avatar astik commented on August 28, 2024 1

Yes i am =)
I already work on the naive solution past week-end.

Still a WIP as it needs better polishing.

from ansible-beats.

astik avatar astik commented on August 28, 2024

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.

astik avatar astik commented on August 28, 2024

Follow up on this ticket:

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"
					}
				}
			}
		}
	}
}

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.

astik avatar astik commented on August 28, 2024

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.

jmlrt avatar jmlrt commented on August 28, 2024

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.

jmlrt avatar jmlrt commented on August 28, 2024

fixed by #78

from ansible-beats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.