Curator Delete indices based on environment variable


(tweety) #1

Hi

I am trying to delete indices and want to pass unit_count as a parameter so that we can dynamically decide the unit_count.

{filtertype: age, source: name, direction: older, timestring: '%Y_%m_%d', unit: days, unit_count: ${UNIT_COUNT},

"", line 53, column 113:
... %m_%d', unit: days, unit_count: %{UNIT_COUNT}, exclude: null}


(Aaron Mildenstein) #2

You haven't provided any extra context or configuration data here, so I can't guess effectively, but I'll try anyway.

This is wrapped in curly braces like JSON, but without any quotes around the keys or values. Are you trying to make a line here for curator_cli's --filter_list argument?


(tweety) #3

This is a yml file. containing action. This is curator for deleting indices.

'5':
        action: delete_indices
        description: 'Deleting closed indices'
        options:
            ignore_empty_list: true
            timeout_override: 40000
            continue_if_exception: false
            disable_action: false
        filters:
            - {filtertype: closed, exclude: False}
            - {filtertype: pattern, kind: prefix, value: xyz_, exclude: False}
            - {filtertype: age, source: name, direction: older, timestring: '%Y_%m_%d', unit: days, unit_count: ${unit_count}, exclude: null}

(Aaron Mildenstein) #4

I do not think that flow-style mapping will work with environment variables. The structure should be:

filters:
  - filtertype: closed
    exclude: false
  - filtertype: pattern
    kind: prefix
    value: xyz_
    exclude: false
  - filtertype: age
    source: name
    direction: older
    timestring: '%Y_%m_%d'
    unit: days
    unit_count: ${unit_count}

Keep in mind that most environment variables are all caps, so if you do have one named $unit_count, that's fine, but typically it would be $UNIT_COUNT.


(tweety) #6

Aha...I understand your point. I used online formatter to format my file and it was running correctly unless I felt the need to add place holder ($VAR) :slight_smile:

Thanks for helping me on this.


(system) #7

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