[Solved]Elasticsearch curator delete error?

HI,

curator 4.2.6

Action file
---
# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True.  If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:
  1:
    action: delete_indices
    description: >-
      Delete indices older than 45 days (based on index name), for logstash-
      prefixed indices. 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: age
      source: creation_date
      direction: older
      unit: days
      unit_count: 1
      exclude:

When i executed the action file in curator i got an error like this:

hero@5684:~/.curator$ curator --dry-run --config curator.yml delete.yml
Traceback (most recent call last):
  File "/usr/local/bin/curator", line 9, in <module>
    load_entry_point('elasticsearch-curator==4.2.6', 'console_scripts', 'curator')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/curator/cli.py", line 125, in cli
    action_config = get_yaml(action_file)
  File "/usr/local/lib/python2.7/dist-packages/curator/utils.py", line 53, in get_yaml
    cfg = yaml.load(raw)
  File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 71, in load
    return loader.get_single_data()
  File "/usr/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in get_single_data
    node = self.get_single_node()
  File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 39, in get_single_node
    if not self.check_event(StreamEndEvent):
  File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 98, in check_event
    self.current_event = self.state()
  File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 174, in parse_document_start
    self.peek_token().start_mark)
yaml.parser.ParserError: expected '<document start>', but found '<block mapping start>'
  in "<string>", line 7, column 1:
    actions:
    ^

May i know why i got this error?

I also tried it by giving
hero@5684:~/.curator$ curator --dry-run --config ~/.curator/curator.yml ~/.curator/delete.yml

Sorry, i didn't closed the comment with # in config file. so that's error ..

i used the command like this
hero@5684:~/.curator$ curator --dry-run --config curator.yml delete.yml

A YAML file must start with --- or the first block mapping element.

Action file
---
# Remember, leave a key empty if there is no value.  None will be a string,
# not a Python "NoneType"
#
# Also remember that all examples have 'disable_action' set to True.  If you
# want to use this action as a template, be sure to set this to False after
# copying it.
actions:

The error here is that the words Action file seem to be at the beginning of your file, instead of --- or actions:.

Either of those is acceptable, so your action file might begin like:

---
actions:
  1:
    action: delete_indices
    # everything else as constituted...

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