Curator 5.5.4 Environment variable HowTo?

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

I looked over this and based on

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

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.

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