2017-02-15 4 views
1

Ich möchte die Elasticsearch Indizes älter als 7 Tage löschen. Also habe ich kurator 4.2 installiert, da meine elasticsearch version 5.0.0 ist (kuratorversion vor 4.x sind nicht kompatibel mit elasticsearch v5)Fehler beim Ausführen des Kurators zum Löschen älterer Indizes

wir müssen eine konfigurationsdatei und eine aktionsdatei erstellen, damit das funktioniert. Ich habe meine Config und Aktionsdatei im Stammverzeichnis erstellt

Meine Konfigurationsdatei curator.yml ist

--- 
# 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: 
    aws_key: 
    aws_secret_key: 
    aws_region: 
    ssl_no_validate: False 
    http_auth: 
    timeout: 30 
    master_only: False 

logging: 
    loglevel: INFO 
    logfile: 
    logformat: default 
    blacklist: ['elasticsearch', 'urllib3'] 

Meine Aktion Datei curatorAction.yml ist

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: True 
    filters: 
    - filtertype: pattern 
     kind: prefix 
     value: logstash- 
     exclude: 
    - filtertype: age 
     source: name 
     direction: older 
     timestring: '%Y.%m.%d' 
     unit: days 
     unit_count: 7 
     exclude: 

ich die Kuratorin leite mit die CLI als

curator --config curator.yml --dry-run curatorAction.yml 

aber ich bekomme diesen Fehler. Ich kann nirgendwo etwas finden. Jede Hilfe wird geschätzt.

2017-02-15 17:52:02,991 ERROR  Schema error: extra keys not allowed @ data[1] 
    Traceback (most recent call last): 
     File "/usr/local/bin/curator", line 11, in <module> 
     load_entry_point('elasticsearch-curator==4.2.6', 'console_scripts', 'curator')() 
     File "/usr/local/lib/python2.7/site-packages/click/core.py", line 722, in __call__ 
     return self.main(*args, **kwargs) 
     File "/usr/local/lib/python2.7/site-packages/click/core.py", line 697, in main 
     rv = self.invoke(ctx) 
     File "/usr/local/lib/python2.7/site-packages/click/core.py", line 895, in invoke 
     return ctx.invoke(self.callback, **ctx.params) 
     File "/usr/local/lib/python2.7/site-packages/click/core.py", line 535, in invoke 
     return callback(*args, **kwargs) 
     File "/usr/local/lib/python2.7/site-packages/curator/cli.py", line 126, in cli 
     action_dict = validate_actions(action_config) 
     File "/usr/local/lib/python2.7/site-packages/curator/utils.py", line 1085, in validate_actions 
     root = SchemaCheck(data, actions.root(), 'Actions File', 'root').result() 
     File "/usr/local/lib/python2.7/site-packages/curator/validators/schemacheck.py", line 68, in result 
     self.test_what, self.location, self.badvalue, self.error) 
    curator.exceptions.ConfigurationError: Configuration: Actions File: Location: root: Bad Value: "{'action': 'delete_indices', 'description': 'Delete selected indices', 'filters': [{'exclude': None, 'kind': 'prefix', 'filtertype': 'pattern', 'value': 'logstash-'}, {'source': 'name', 'direction': 'older', 'unit_count': 30, 'timestring': '%Y.%m.%d', 'exclude': None, 'filtertype': 'age', 'unit': 'days'}], 'options': {'continue_if_exception': False, 'timeout_override': None, 'disable_action': False}}", extra keys not allowed @ data[1]. Check configuration file. 
+1

Sind Sie 100% sicher, dass alles vollständig korrekt formatiert ist? Ich habe deine Action-YAML-Datei kopiert und eingefügt und sie lief wunderbar für mich. – untergeek

+0

Ich denke, es gab nur ein Problem der Einrückung. Ich habe die Dateien gelöscht und neu erstellt. ** Es hat funktioniert ** –

Antwort

0

Ich kann nichts finden, das mit Ihrer curatorAction.yml-Datei falsch ist. In der Tat ist das unten die Ausgabe von meinem Laufen es. Ich schneide/Einfügen genau, was Sie oben haben, minus disable_action: True in test2.yml:

 
[email protected]:~/.curator# curator --config test.yml --dry-run test2.yml 
2017-02-15 15:48:53,705 INFO  Preparing Action ID: 1, "delete_indices" 
2017-02-15 15:48:53,713 INFO  Trying Action ID: 1, "delete_indices": 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. 
2017-02-15 15:48:54,034 INFO  DRY-RUN MODE. No changes will be made. 
2017-02-15 15:48:54,034 INFO  (CLOSED) indices may be shown that may not be acted on by action "delete_indices". 
2017-02-15 15:48:54,034 INFO  DRY-RUN: delete_indices: logstash-2017.01.06 with arguments: {} 
2017-02-15 15:48:54,034 INFO  DRY-RUN: delete_indices: logstash-2017.02.01 (CLOSED) with arguments: {} 
2017-02-15 15:48:54,034 INFO  DRY-RUN: delete_indices: logstash-2017.02.02 with arguments: {} 
2017-02-15 15:48:54,034 INFO  DRY-RUN: delete_indices: logstash-2017.02.03 with arguments: {} 
2017-02-15 15:48:54,034 INFO  DRY-RUN: delete_indices: logstash-2017.02.04 with arguments: {} 
2017-02-15 15:48:54,035 INFO  DRY-RUN: delete_indices: logstash-2017.02.05 with arguments: {} 
2017-02-15 15:48:54,035 INFO  DRY-RUN: delete_indices: logstash-2017.02.06 with arguments: {} 
2017-02-15 15:48:54,035 INFO  DRY-RUN: delete_indices: logstash-2017.02.07 with arguments: {} 
2017-02-15 15:48:54,035 INFO  DRY-RUN: delete_indices: logstash-2017.02.08 with arguments: {} 
2017-02-15 15:48:54,035 INFO  Action ID: 1, "delete_indices" completed. 
2017-02-15 15:48:54,035 INFO  Job completed. 

Auch die einzige Änderung, die ich war, machte disable_action: False einstellen -OR nur die Zeile löschen ganz-so würde nichts laufen mit ihm gesetzt zu True.

Das erklärt nicht Ihren Fehler, der anzeigt, dass Ihre Datei falsch formatiert ist. Es gibt einen Schlüssel auf root-Ebene, den es nicht mag, aber ausschneiden/einfügen, und es funktioniert für mich, so dass ich nicht sagen kann, wie oder warum Ihr möglicherweise falsch formatiert ist.

Haben Sie ein DOS-Zeilenumbruchzeichen für Ihre curatorAction.yml-Datei oder etwas ähnliches verwendet?

+1

Nein, ich habe kein DOS-Zeilenumbruchzeichen verwendet. Problem war nur mit der Einrückung. Es wurde repariert, indem die Dateien neu erstellt wurden. –

Verwandte Themen