From dc2fac7c0cbdbe11c074496baefc4075ef13210a Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Mon, 13 Oct 2014 15:13:34 -0400 Subject: [PATCH] logstash service: make log verbosity configurable. --- nixos/modules/services/logging/logstash.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index 41f71be2365c..117ee1c900f5 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -7,6 +7,13 @@ let pluginPath = lib.concatStringsSep ":" cfg.plugins; havePluginPath = lib.length cfg.plugins > 0; ops = lib.optionalString; + verbosityFlag = { + debug = "--debug"; + info = "--verbose"; + warn = ""; # intentionally empty + error = "--quiet"; + fatal = "--silent"; + }."${cfg.logLevel}"; in @@ -37,6 +44,12 @@ in description = "The paths to find other logstash plugins in."; }; + logLevel = mkOption { + type = types.enum [ "debug" "info" "warn" "error" "fatal" ]; + default = "warn"; + description = "Logging verbosity level."; + }; + watchdogTimeout = mkOption { type = types.int; default = 10; @@ -124,6 +137,7 @@ in "${cfg.package}/bin/logstash agent " + "-w ${toString cfg.filterWorkers} " + ops havePluginPath "--pluginpath ${pluginPath} " + + "${verbosityFlag} " + "--watchdog-timeout ${toString cfg.watchdogTimeout} " + "-f ${writeText "logstash.conf" '' input {