# \[SOLVED\] Curator 4: Variables in action.yml

**URL:** <https://discuss.elastic.co/t/solved-curator-4-variables-in-action-yml/55506>\
**Category:** Elastic Community and Ecosystem\
**Created:** [July 14, 2016, 10:26am UTC](https://discuss.elastic.co/t/solved-curator-4-variables-in-action-yml/55506 "2016-07-14T10:26:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Suny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suny/32/22082_2.png) [@Suny](https://discuss.elastic.co/u/Suny)\
**Post date:** [July 14, 2016, 10:26am UTC](https://discuss.elastic.co/t/solved-curator-4-variables-in-action-yml/55506/1 "2016-07-14T10:26:59Z")

</div>

Sorry, I should have read [https://www.elastic.co/guide/en/elasticsearch/client/curator/current/option\_name.html](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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:43pm UTC](https://discuss.elastic.co/t/solved-curator-4-variables-in-action-yml/55506/2 "2017-07-06T13:43:59Z")

</div>


