diff options
author | David Smith <shmish111@gmail.com> | 2018-08-21 09:39:25 +0100 |
---|---|---|
committer | Bas van Dijk <v.dijk.bas@gmail.com> | 2018-08-25 18:53:10 +0200 |
commit | 842000566b5d7cab0a7ed5b1cd1ee00962175a2b (patch) | |
tree | 52cfd9e26866d1163c3550e58983a165339ff840 /nixos | |
parent | 2ec33f527b604ae438e34fc598d85c50d88e4a61 (diff) | |
download | nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.gz nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.bz2 nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.lz nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.xz nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.zst nixlib-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.zip |
elasticsearch-curator: add test
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/tests/elk.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/elk.nix b/nixos/tests/elk.nix index 4c5c441ca265..665e27a05534 100644 --- a/nixos/tests/elk.nix +++ b/nixos/tests/elk.nix @@ -63,6 +63,33 @@ let package = elk.kibana; elasticsearch.url = esUrl; }; + + elasticsearch-curator = { + enable = true; + actionYAML = '' + --- + actions: + 1: + action: delete_indices + description: >- + Delete indices older than 1 minute (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 + disable_action: False + filters: + - filtertype: pattern + kind: prefix + value: logstash- + - filtertype: age + source: name + direction: older + timestring: '%Y.%m.%d' + unit: minutes + unit_count: 1 + ''; + }; }; }; }; @@ -91,6 +118,9 @@ let # See if logstash messages arive in elasticsearch. $one->waitUntilSucceeds("curl --silent --show-error '${esUrl}/_search' -H 'Content-Type: application/json' -d '{\"query\" : { \"match\" : { \"message\" : \"flowers\"}}}' | jq .hits.total | grep -v 0"); $one->waitUntilSucceeds("curl --silent --show-error '${esUrl}/_search' -H 'Content-Type: application/json' -d '{\"query\" : { \"match\" : { \"message\" : \"dragons\"}}}' | jq .hits.total | grep 0"); + $one->systemctl("stop logstash"); + $one->systemctl("start elasticsearch-curator"); + $one->waitUntilSucceeds("! curl --silent --show-error '${esUrl}/_cat/indices' | grep logstash | grep -q ^$1"); ''; }; in mapAttrs mkElkTest { |