diff options
author | Jaka Hudoklin <jakahudoklin@gmail.com> | 2014-10-12 23:02:52 +0200 |
---|---|---|
committer | Jaka Hudoklin <jakahudoklin@gmail.com> | 2014-10-12 23:02:52 +0200 |
commit | dd0758ab6b1ac3a96e99661f159a62942b31240e (patch) | |
tree | 74104e0cdae08ee89d818d83be5b37ba8fd8c83f /nixos | |
parent | 42da129d34928ef338e1e8a1681f5bbe8183ce3d (diff) | |
parent | fc7098abf772ad5b4e737f4e6df1fd8b7e9e7f2b (diff) | |
download | nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar.gz nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar.bz2 nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar.lz nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar.xz nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.tar.zst nixlib-dd0758ab6b1ac3a96e99661f159a62942b31240e.zip |
Merge pull request #4392 from cstrahan/logstash
logstash service improvements
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/logging/logstash.nix | 69 |
1 files changed, 58 insertions, 11 deletions
diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index df81ac142dc3..41f71be2365c 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -4,6 +4,9 @@ with lib; let cfg = config.services.logstash; + pluginPath = lib.concatStringsSep ":" cfg.plugins; + havePluginPath = lib.length cfg.plugins > 0; + ops = lib.optionalString; in @@ -20,12 +23,50 @@ in description = "Enable logstash."; }; + package = mkOption { + type = types.package; + default = pkgs.logstash; + example = literalExample "pkgs.logstash"; + description = "Logstash package to use."; + }; + + plugins = mkOption { + type = types.listOf types.path; + default = [ ]; + example = literalExample "[ pkgs.logstash-contrib ]"; + description = "The paths to find other logstash plugins in."; + }; + + watchdogTimeout = mkOption { + type = types.int; + default = 10; + description = "Set watchdog timeout value in seconds."; + }; + + filterWorkers = mkOption { + type = types.int; + default = 1; + description = "The quantity of filter workers to run."; + }; + enableWeb = mkOption { type = types.bool; default = false; description = "Enable the logstash web interface."; }; + address = mkOption { + type = types.str; + default = "0.0.0.0"; + description = "Address on which to start webserver."; + }; + + port = mkOption { + type = types.str; + default = "9292"; + description = "Port on which to start webserver."; + }; + inputConfig = mkOption { type = types.lines; default = ''stdin { type => "example" }''; @@ -79,19 +120,25 @@ in wantedBy = [ "multi-user.target" ]; environment = { JAVA_HOME = jre; }; serviceConfig = { - ExecStart = "${logstash}/bin/logstash agent -f ${writeText "logstash.conf" '' - input { - ${cfg.inputConfig} - } + ExecStart = + "${cfg.package}/bin/logstash agent " + + "-w ${toString cfg.filterWorkers} " + + ops havePluginPath "--pluginpath ${pluginPath} " + + "--watchdog-timeout ${toString cfg.watchdogTimeout} " + + "-f ${writeText "logstash.conf" '' + input { + ${cfg.inputConfig} + } - filter { - ${cfg.filterConfig} - } + filter { + ${cfg.filterConfig} + } - output { - ${cfg.outputConfig} - } - ''} ${optionalString cfg.enableWeb "-- web"}"; + output { + ${cfg.outputConfig} + } + ''} " + + ops cfg.enableWeb "-- web -a ${cfg.address} -p ${cfg.port}"; }; }; }; |