Where does Curator get the current time?


#1

This is the action file I have set up:

actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 3 hours. Ignore the error if the filter does not result in an
      actionable list of indices (ignore_empty_list) and exit cleanly.
    options:
      ignore_empty_list: True
      timeout_override:
      continue_if_exception: False
      disable_action: False
    filters:
    - filtertype: pattern
      kind: suffix
      value: varnishfront
      exclude:
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y-%m-%d-%H'
      unit: hours
      unit_count: 3
      exclude:

I wanted to know where does curator get the current "%Y-%m-%d-%H" to compare on what to delete and what not to.


(Aaron Mildenstein) #2

It just captures UTC in that moment, and reverse translates that to the individual symbols used in strftime.

See: https://github.com/elastic/curator/blob/4099e0f33e18d825c0265859a895e018dcd2631d/curator/utils.py#L985-L1019

Specifically note datetime.utcnow(), as that's what is being used as the starting point.


(system) #3