[SOLVED] Curator 4: Variables in action.yml


(Suny Kim) #1

Sorry, I should have read https://www.elastic.co/guide/en/elasticsearch/client/curator/current/option_name.html ...

Solution is:

      name: logstash-%Y.%m.%d

And please ignore everything below this line.


For historic reasons, every day we create an alias with curator 3 in a shell script:

TODAY=$(date +%Y.%m.%d)
alias --name logstash-${TODAY} indices --suffix logstash-${TODAY}

We are now migrating to curator 4. The --suffix logstash-${TODAY} translates into age + timestring, but how would we handle a dynamic name in the yaml? It would work to change the yaml before the run with a shell script, but this feels a bit clumsy.

action: alias
description: Create alias with old pattern
options:
  name: logstash- ???

My ugly solution (but it is a solution):
/etc/curator/action_alias_var.yml


actions:
  1:
    action: alias
    description: 
    options:
      name: ALIAS_NAME
      continue_if_exception: False
    add:
      filters:
      - filtertype: age
        source: name
        direction: younger
        timestring: '%Y.%m.%d'
        unit: days
        unit_count: 1

sed "s/ALIAS_NAME/logstash-$(date +%Y.%m.%d)/" /etc/curator/action_alias_var.yml > /etc/curator/action_alias.yml
curator --config /etc/curator/curator.yml /etc/curator/action_alias.yml


(system) #2