summary refs log tree commit diff
path: root/nixos/modules/services/logging/logstash.nix
diff options
context:
space:
mode:
authorJaka Hudoklin <jakahudoklin@gmail.com>2013-10-31 15:59:59 +0100
committerJaka Hudoklin <jakahudoklin@gmail.com>2013-11-01 17:15:54 +0100
commit1453be4740f9735a2a66480a68f3648cab7684d2 (patch)
tree0228c18b0eda4f2c4283e837a2c3548c3c069ea6 /nixos/modules/services/logging/logstash.nix
parent10e61f53d8d4cd9aa8eefa93ddd23c5428784720 (diff)
downloadnixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar.gz
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar.bz2
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar.lz
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar.xz
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.tar.zst
nixlib-1453be4740f9735a2a66480a68f3648cab7684d2.zip
nixos/logstash: add option examples
Diffstat (limited to 'nixos/modules/services/logging/logstash.nix')
-rw-r--r--nixos/modules/services/logging/logstash.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix
index 373476c66999..21128779e8f6 100644
--- a/nixos/modules/services/logging/logstash.nix
+++ b/nixos/modules/services/logging/logstash.nix
@@ -20,16 +20,39 @@ in
       inputConfig = mkOption {
         default = ''stdin { type => "example" }'';
         description = "Logstash input configuration";
+        example = ''
+          # Read from journal
+          pipe {
+            command => "${pkgs.systemd}/bin/journalctl -f -o json"
+            type => "syslog" codec => json {}
+          }
+        '';
       };
 
       filterConfig = mkOption {
         default = ''noop {}'';
         description = "logstash filter configuration";
+        example = ''
+          if [type] == "syslog" {
+            # Keep only relevant systemd fields
+            # http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html
+            prune {
+              whitelist_names => [
+                "type", "@timestamp", "@version",
+                "MESSAGE", "PRIORITY", "SYSLOG_FACILITY",
+              ]
+            }
+          }
+        '';
       };
 
       outputConfig = mkOption {
         default = ''stdout { debug => true debug_format => "json"}'';
         description = "Logstash output configuration";
+        example = ''
+          redis { host => "localhost" data_type => "list" key => "logstash" codec => json }
+          elasticsearch { embedded => true }
+        '';
       };
     };
   };