logstash: update default version to v6

This commit is contained in:
Jörg Thalheim 2018-08-03 11:23:56 +01:00
parent cd62790201
commit 13db07a092
5 changed files with 31 additions and 103 deletions

View file

@ -257,6 +257,7 @@ with lib;
(mkRemovedOptionModule [ "fonts" "fontconfig" "forceAutohint" ] "")
(mkRemovedOptionModule [ "fonts" "fontconfig" "renderMonoTTFAsBitmap" ] "")
(mkRemovedOptionModule [ "virtualisation" "xen" "qemu" ] "You don't need this option anymore, it will work without it.")
(mkRemovedOptionModule [ "services" "logstash" "enableWeb" ] "The web interface was removed from logstash")
# ZSH
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])

View file

@ -4,25 +4,12 @@ with lib;
let
cfg = config.services.logstash;
atLeast54 = versionAtLeast (builtins.parseDrvName cfg.package.name).version "5.4";
pluginPath = lib.concatStringsSep ":" cfg.plugins;
havePluginPath = lib.length cfg.plugins > 0;
ops = lib.optionalString;
verbosityFlag =
if atLeast54
then "--log.level " + cfg.logLevel
else {
debug = "--debug";
info = "--verbose";
warn = ""; # intentionally empty
error = "--quiet";
fatal = "--silent";
}."${cfg.logLevel}";
verbosityFlag = "--log.level " + cfg.logLevel;
pluginsPath =
if atLeast54
then "--path.plugins ${pluginPath}"
else "--pluginpath ${pluginPath}";
pluginsPath = "--path.plugins ${pluginPath}";
logstashConf = pkgs.writeText "logstash.conf" ''
input {
@ -63,7 +50,7 @@ in
type = types.package;
default = pkgs.logstash;
defaultText = "pkgs.logstash";
example = literalExample "pkgs.logstash";
example = literalExample "pkgs.logstash5";
description = "Logstash package to use.";
};
@ -95,12 +82,6 @@ in
description = "The quantity of filter workers to run.";
};
enableWeb = mkOption {
type = types.bool;
default = false;
description = "Enable the logstash web interface.";
};
listenAddress = mkOption {
type = types.str;
default = "127.0.0.1";
@ -174,16 +155,6 @@ in
###### implementation
config = mkIf cfg.enable {
assertions = [
{ assertion = atLeast54 -> !cfg.enableWeb;
message = ''
The logstash web interface is only available for versions older than 5.4.
So either set services.logstash.enableWeb = false,
or set services.logstash.package to an older logstash.
'';
}
];
systemd.services.logstash = with pkgs; {
description = "Logstash Daemon";
wantedBy = [ "multi-user.target" ];
@ -193,14 +164,12 @@ in
ExecStartPre = ''${pkgs.coreutils}/bin/mkdir -p "${cfg.dataDir}" ; ${pkgs.coreutils}/bin/chmod 700 "${cfg.dataDir}"'';
ExecStart = concatStringsSep " " (filter (s: stringLength s != 0) [
"${cfg.package}/bin/logstash"
(ops (!atLeast54) "agent")
"-w ${toString cfg.filterWorkers}"
(ops havePluginPath pluginsPath)
"${verbosityFlag}"
"-f ${logstashConf}"
(ops atLeast54 "--path.settings ${logstashSettingsDir}")
(ops atLeast54 "--path.data ${cfg.dataDir}")
(ops cfg.enableWeb "-- web -a ${cfg.listenAddress} -p ${cfg.port}")
"--path.settings ${logstashSettingsDir}"
"--path.data ${cfg.dataDir}"
]);
};
};

View file

@ -1,53 +0,0 @@
{ elk6Version
, enableUnfree ? true
, stdenv
, fetchurl
, makeWrapper
, jre
}:
with stdenv.lib;
stdenv.mkDerivation rec {
version = elk6Version;
name = "logstash-${optionalString (!enableUnfree) "oss-"}${version}";
src = fetchurl {
url = "https://artifacts.elastic.co/downloads/logstash/${name}.tar.gz";
sha256 =
if enableUnfree
then "0yx9hpiav4d5z1b52x2h5i0iknqs9lmxy8vmz0wkb23mjiz8njdr"
else "1ir8pbq706mxr56k5cgc9ajn2jp603zrqj66dimx6xxf2nfamw0w";
};
dontBuild = true;
dontPatchELF = true;
dontStrip = true;
dontPatchShebangs = true;
buildInputs = [
makeWrapper jre
];
installPhase = ''
mkdir -p $out
cp -r {Gemfile*,modules,vendor,lib,bin,config,data,logstash-core,logstash-core-plugin-api} $out
patchShebangs $out/bin/logstash
patchShebangs $out/bin/logstash-plugin
wrapProgram $out/bin/logstash \
--set JAVA_HOME "${jre}"
wrapProgram $out/bin/logstash-plugin \
--set JAVA_HOME "${jre}"
'';
meta = with stdenv.lib; {
description = "Logstash is a data pipeline that helps you process logs and other event data from a variety of systems";
homepage = https://www.elastic.co/products/logstash;
license = if enableUnfree then licenses.elastic else licenses.asl20;
platforms = platforms.unix;
maintainers = with maintainers; [ wjlroe offline basvandijk ];
};
}

View file

@ -1,12 +1,23 @@
{ stdenv, fetchurl, makeWrapper, jre }:
{ elk6Version
, enableUnfree ? true
, stdenv
, fetchurl
, makeWrapper
, jre
}:
with stdenv.lib;
stdenv.mkDerivation rec {
version = "2.4.0";
name = "logstash-${version}";
version = elk6Version;
name = "logstash-${optionalString (!enableUnfree) "oss-"}${version}";
src = fetchurl {
url = "https://download.elasticsearch.org/logstash/logstash/logstash-${version}.tar.gz";
sha256 = "1k27hb6q1r26rp3y9pb2ry92kicw83mi352dzl2y4h0gbif46b32";
url = "https://artifacts.elastic.co/downloads/logstash/${name}.tar.gz";
sha256 =
if enableUnfree
then "0yx9hpiav4d5z1b52x2h5i0iknqs9lmxy8vmz0wkb23mjiz8njdr"
else "1ir8pbq706mxr56k5cgc9ajn2jp603zrqj66dimx6xxf2nfamw0w";
};
dontBuild = true;
@ -20,14 +31,14 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out
cp -r {Gemfile*,vendor,lib,bin} $out
cp -r {Gemfile*,modules,vendor,lib,bin,config,data,logstash-core,logstash-core-plugin-api} $out
patchShebangs $out/bin/logstash
patchShebangs $out/bin/logstash-plugin
wrapProgram $out/bin/logstash \
--set JAVA_HOME "${jre}"
wrapProgram $out/bin/rspec \
--set JAVA_HOME "${jre}"
wrapProgram $out/bin/logstash-plugin \
--set JAVA_HOME "${jre}"
'';
@ -35,8 +46,8 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; {
description = "Logstash is a data pipeline that helps you process logs and other event data from a variety of systems";
homepage = https://www.elastic.co/products/logstash;
license = licenses.asl20;
license = if enableUnfree then licenses.elastic else licenses.asl20;
platforms = platforms.unix;
maintainers = [ maintainers.wjlroe maintainers.offline ];
maintainers = with maintainers; [ wjlroe offline basvandijk ];
};
}

View file

@ -3468,12 +3468,12 @@ with pkgs;
lockfileProgs = callPackage ../tools/misc/lockfile-progs { };
logstash = callPackage ../tools/misc/logstash { };
logstash5 = callPackage ../tools/misc/logstash/5.x.nix { };
logstash6 = callPackage ../tools/misc/logstash/6.x.nix { };
logstash6-oss = callPackage ../tools/misc/logstash/6.x.nix {
logstash6 = callPackage ../tools/misc/logstash { };
logstash6-oss = callPackage ../tools/misc/logstash {
enableUnfree = false;
};
logstash = logstash6;
logstash-contrib = callPackage ../tools/misc/logstash/contrib.nix { };