forked from mirrors/nixpkgs
logstash service improvements
* add logstash-contrib plugins package * add additional options to the logstash service
This commit is contained in:
parent
58de52c6f0
commit
fc7098abf7
|
@ -4,6 +4,9 @@ with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.services.logstash;
|
cfg = config.services.logstash;
|
||||||
|
pluginPath = lib.concatStringsSep ":" cfg.plugins;
|
||||||
|
havePluginPath = lib.length cfg.plugins > 0;
|
||||||
|
ops = lib.optionalString;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
|
@ -20,12 +23,50 @@ in
|
||||||
description = "Enable logstash.";
|
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 {
|
enableWeb = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Enable the logstash web interface.";
|
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 {
|
inputConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.lines;
|
||||||
default = ''stdin { type => "example" }'';
|
default = ''stdin { type => "example" }'';
|
||||||
|
@ -79,7 +120,12 @@ in
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
environment = { JAVA_HOME = jre; };
|
environment = { JAVA_HOME = jre; };
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = "${logstash}/bin/logstash agent -f ${writeText "logstash.conf" ''
|
ExecStart =
|
||||||
|
"${cfg.package}/bin/logstash agent " +
|
||||||
|
"-w ${toString cfg.filterWorkers} " +
|
||||||
|
ops havePluginPath "--pluginpath ${pluginPath} " +
|
||||||
|
"--watchdog-timeout ${toString cfg.watchdogTimeout} " +
|
||||||
|
"-f ${writeText "logstash.conf" ''
|
||||||
input {
|
input {
|
||||||
${cfg.inputConfig}
|
${cfg.inputConfig}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +137,8 @@ in
|
||||||
output {
|
output {
|
||||||
${cfg.outputConfig}
|
${cfg.outputConfig}
|
||||||
}
|
}
|
||||||
''} ${optionalString cfg.enableWeb "-- web"}";
|
''} " +
|
||||||
|
ops cfg.enableWeb "-- web -a ${cfg.address} -p ${cfg.port}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
31
pkgs/tools/misc/logstash/contrib.nix
Normal file
31
pkgs/tools/misc/logstash/contrib.nix
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{ stdenv, lib, fetchzip }:
|
||||||
|
|
||||||
|
# Note that plugins are supposed to be installed as:
|
||||||
|
# $path/logstash/{inputs,codecs,filters,outputs}/*.rb
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
version = "1.4.2";
|
||||||
|
name = "logstash-contrib-${version}";
|
||||||
|
|
||||||
|
src = fetchzip {
|
||||||
|
url = "http://download.elasticsearch.org/logstash/logstash/logstash-contrib-${version}.tar.gz";
|
||||||
|
sha256 = "1yj8sf3b526gixh3c6zhgkfpg4f0c72p1lzhfhdx8b3lw7zjkj0k";
|
||||||
|
};
|
||||||
|
|
||||||
|
dontBuild = true;
|
||||||
|
dontPatchELF = true;
|
||||||
|
dontStrip = true;
|
||||||
|
dontPatchShebangs = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/logstash
|
||||||
|
cp -r lib/* $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "Community-maintained logstash plugins";
|
||||||
|
homepage = https://github.com/elasticsearch/logstash-contrib;
|
||||||
|
license = stdenv.lib.licenses.asl20;
|
||||||
|
platforms = stdenv.lib.platforms.unix;
|
||||||
|
maintainers = with maintainers; [ cstrahan ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1494,6 +1494,8 @@ let
|
||||||
|
|
||||||
logstash = callPackage ../tools/misc/logstash { };
|
logstash = callPackage ../tools/misc/logstash { };
|
||||||
|
|
||||||
|
logstash-contrib = callPackage ../tools/misc/logstash/contrib.nix { };
|
||||||
|
|
||||||
logstash-forwarder = callPackage ../tools/misc/logstash-forwarder { };
|
logstash-forwarder = callPackage ../tools/misc/logstash-forwarder { };
|
||||||
|
|
||||||
kippo = callPackage ../servers/kippo { };
|
kippo = callPackage ../servers/kippo { };
|
||||||
|
|
Loading…
Reference in a new issue