diff options
Diffstat (limited to 'nixos/tests/elk.nix')
-rw-r--r-- | nixos/tests/elk.nix | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/nixos/tests/elk.nix b/nixos/tests/elk.nix index 4c5c441ca265..15be72b80bba 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 second (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: seconds + unit_count: 1 + ''; + }; }; }; }; @@ -91,6 +118,11 @@ 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"); + + # Test elasticsearch-curator. + $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 { |