From 1453be4740f9735a2a66480a68f3648cab7684d2 Mon Sep 17 00:00:00 2001 From: Jaka Hudoklin Date: Thu, 31 Oct 2013 15:59:59 +0100 Subject: [PATCH] nixos/logstash: add option examples --- nixos/modules/services/logging/logstash.nix | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 } + ''; }; }; };