# Curator 5.5.4 Environment variable HowTo?

**URL:** <https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286>\
**Category:** Elasticsearch\
**Created:** [October 27, 2018, 11:47am UTC](https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286 "2018-10-27T11:47:35Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arberg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arberg/32/93644_2.png) [@arberg](https://discuss.elastic.co/u/arberg)\
**Post date:** [October 27, 2018, 11:47am UTC](https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286/1 "2018-10-27T11:47:35Z")

</div>

I'm trying to reindex with environment variable. I have many indexes like service1- and service2- and want to reindex into monthly index, without having 10 near-identical actions.

I understood that i need to have entire field being an env variable, I don't do "${VAR1}-${VAR2}". But still I cannot get it to work.

I don't really want the default values but tried it, nothing works. I've tried both

`index: "${CURATOR_DEST_INDEX:env-default-logstash-2018.08}"`  
and  
`index: "${CURATOR_DEST_INDEX}"`

I run: bash  
CURATOR\_DEST\_INDEX=logstash-2018.08.3  
CURATOR\_SOURCE\_INDEX\_PREFIX=test2-logstash-2018.08  
curator actions/reindex-env.yml --config config/curator.yml

################################## My action:  
actions:  
1:  
description: \>-  
Reindex all daily logstash indices into monthly indexes. Specified via environment variables:  
action: reindex  
options:  
wait\_interval: 9  
max\_wait: -1  
request\_body:  
source:  
index: REINDEX\_SELECTION  
dest:  
index: "${CURATOR\_DEST\_INDEX:env-default-logstash-2018.08}"  
filters:  
- filtertype: pattern  
kind: prefix  
value: "${CURATOR\_SOURCE\_INDEX\_PREFIX:logstash-2018.08.3}"  
################################## End

################################## My Config  
---  
# Remember, leave a key empty if there is no value. None will be a string,  
# not a Python "NoneType"  
client:  
hosts:  
- 127.0.0.1  
port: 9200  
url\_prefix:  
use\_ssl: False  
certificate:  
client\_cert:  
client\_key:  
ssl\_no\_validate: False  
http\_auth:  
timeout: 30  
master\_only: False

```
logging:
  loglevel: INFO
  logfile:
  logformat: default
  blacklist: ['elasticsearch', 'urllib3'] 

```

################################## End

PS: The formatting 4-indent-codeblock didn't work, hence the crazy formatting in this note

---

<div class="post-metadata">

**Author:** ![bloke](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@bloke](https://discuss.elastic.co/u/bloke)\
**Post date:** [October 27, 2018, 10:28pm UTC](https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286/2 "2018-10-27T22:28:54Z")

</div>

I looked over this and based on

[https://www.elastic.co/guide/en/elasticsearch/client/curator/current/envvars.html](https://www.elastic.co/guide/en/elasticsearch/client/curator/current/envvars.html)

My thoughts are your executing child processes so would you not have to export your variable

`export var=value`

in bash

---

<div class="post-metadata">

**Author:** ![arberg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arberg/32/93644_2.png) [@arberg](https://discuss.elastic.co/u/arberg)\
**Post date:** [November 5, 2018, 2:51pm UTC](https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286/3 "2018-11-05T14:51:06Z")

</div>

Thank you, that was a very good point. I've now used exports and tried running another bash script before the curator to print my variables to make sure they are set. I get the same issue.

I've also tried using this syntax with no effect

> VAR1=value VAR2=otherValue curator ...

Still the DEBUG log says that it cannot find matching indexes. If set the matched indexes, the source-indexes explicitely in action.yml it finds matching indexes, but complains when it gets to the destination index

Log output:

`the index described as "${CURATOR_DEST_INDEX:test-env-default-logstash-2018.08}" was not found after the reindex operation. Check Elasticsearch logs for more information.`

---

<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:** [December 3, 2018, 3:04pm UTC](https://discuss.elastic.co/t/curator-5-5-4-environment-variable-howto/154286/4 "2018-12-03T15:04:17Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
