mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 13:40:28 +03:00
logstash service improvements
* add logstash-contrib plugins package * add additional options to the logstash service
This commit is contained in:
parent
58de52c6f0
commit
fc7098abf7
3 changed files with 91 additions and 11 deletions
|
@ -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}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue