about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorBas van Dijk <v.dijk.bas@gmail.com>2018-08-26 01:33:34 +0200
committerGitHub <noreply@github.com>2018-08-26 01:33:34 +0200
commita144c798e561db99b9bddca562ffb4c3645efe5f (patch)
tree1027e4955f6a6307a16b56a32794a4e89cbb1713 /nixos/tests
parentb2dc75cd03dc6254a4df6d7fb8e3b41989f05a65 (diff)
parent954eb34a5363877e5efed27ddc2bc748f6265019 (diff)
downloadnixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar.gz
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar.bz2
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar.lz
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar.xz
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.tar.zst
nixlib-a144c798e561db99b9bddca562ffb4c3645efe5f.zip
Merge pull request #44340 from shmish111/es-curator
nixos/curator: init elasticsearch curator
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/elk.nix32
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 {