Curator rollover new_index

Hi,

Trying to get indices rolled over when it gets to a max_size limit using a new index name that has the current date in the name of the index. Read online there is a undocumented feature called new_index where you can use Date Math.

Keep getting this ERROR:

> 2019-06-23 18:52:30,462 DEBUG              curator.utils     parse_date_pattern:1348 Fully rendered name: <activemq-dev-{now/d}-1}>
> 2019-06-23 18:52:30,464 DEBUG                curator.cli         process_action:99   Doing the action here.
> 2019-06-23 18:52:30,464 INFO      curator.actions.rollover              do_action:969  Performing index rollover
> 2019-06-23 18:52:30,465 ERROR                curator.cli                    run:191  Failed to complete action: rollover.  <class 'curator.exceptions.FailedExecution'>: Exception encountered.  Rerun with loglevel DEBUG and/or check Elasticsearch logs for more information. Exception: RequestError(400, u'no handler found for uri [/activemq-dev/_rollover/<activemq-dev-{now/d}-1}>?wait_for_active_shards=0&dry_run=false] and method [POST]', u'no handler found for uri [/activemq-dev/_rollover/<activemq-dev-{now/d}-1}>?wait_for_active_shards=0&dry_run=false] and method [POST]')

This is a snip of the configue

  1:
    action: rollover
    description: >-
      Rollover the index associated with alias 'aliasname', which should be in the
      format of prefix-000001 (or similar), or prefix-YYYY.MM.DD-1.
    options:
      name: activemq-dev
      new_index: '<activemq-dev-{now/d}-1}>'
      conditions:
        max_age: 1s
        max_docs: 1000000
        max_size: 5m
      extra_settings:
       index.number_of_shards: 5
       index.number_of_replicas: 1
      disable_action: False

Not sure why it's not creating the index, but not using date math the index gets created (example: activemq-dev-0000001)

Thanks

Works for me.

Create Rollover Index

PUT index-2019.06.27-1
{
  "aliases": {
    "index": {}
  }
}

Rollover action.yml file

---
actions:
  1:
    action: rollover
    options:
      name: index
      new_index: '<index-{now/d}-1>'
      conditions:
        max_age: 1s
      extra_settings:
       index.number_of_shards: 1
       index.number_of_replicas: 1

Log output

2019-06-27 19:46:00,856 DEBUG     curator.actions.rollover             log_result:923  Result: {'acknowledged': True, 'shards_acknowledged': True, 'old_index': 'index-2019.06.27-1', 'new_index': 'index-2019.06.28-1', 'rolled_over': True, 'dry_run': False, 'conditions': {'[max_age: 1s]': True}}
2019-06-27 19:46:00,857 INFO      curator.actions.rollover             log_result:937  Old index index-2019.06.27-1 rolled over to new index index-2019.06.28-1
2019-06-27 19:46:00,857 INFO                 curator.cli                    run:201  Action ID: 1, "rollover" completed.
2019-06-27 19:46:00,857 INFO                 curator.cli                    run:202  Job completed.

I think you have a trailing } character in new_index: '<activemq-dev-{now/d}-1}>'. Perhaps try it as:

new_index: '<activemq-dev-{now/d}-1>'

Thanks for the response, indeed one of the issues was a typo the other was the curator.yml was configured to use a Nginx load balancer address port.

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