summary refs log tree commit diff
path: root/nixos/tests/elk.nix
diff options
context:
space:
mode:
authorDavid Smith <shmish111@gmail.com>2018-08-21 09:39:25 +0100
committerBas van Dijk <v.dijk.bas@gmail.com>2018-08-25 18:53:10 +0200
commit842000566b5d7cab0a7ed5b1cd1ee00962175a2b (patch)
tree52cfd9e26866d1163c3550e58983a165339ff840 /nixos/tests/elk.nix
parent2ec33f527b604ae438e34fc598d85c50d88e4a61 (diff)
downloadnixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.gz
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.bz2
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.lz
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.xz
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.tar.zst
nixpkgs-842000566b5d7cab0a7ed5b1cd1ee00962175a2b.zip
elasticsearch-curator: add test
Diffstat (limited to 'nixos/tests/elk.nix')
-rw-r--r--nixos/tests/elk.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/nixos/tests/elk.nix b/nixos/tests/elk.nix
index 4c5c441ca26..665e27a0553 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 {