From 13db07a092a05f1f692c1f3429fced80d2904526 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 3 Aug 2018 11:23:56 +0100 Subject: [PATCH] logstash: update default version to v6 --- nixos/modules/rename.nix | 1 + nixos/modules/services/logging/logstash.nix | 41 ++-------------- pkgs/tools/misc/logstash/6.x.nix | 53 --------------------- pkgs/tools/misc/logstash/default.nix | 33 ++++++++----- pkgs/top-level/all-packages.nix | 6 +-- 5 files changed, 31 insertions(+), 103 deletions(-) delete mode 100644 pkgs/tools/misc/logstash/6.x.nix diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix index 40f66ccb26b2..fe395c4256bd 100644 --- a/nixos/modules/rename.nix +++ b/nixos/modules/rename.nix @@ -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" ]) diff --git a/nixos/modules/services/logging/logstash.nix b/nixos/modules/services/logging/logstash.nix index 28d89a7463ab..aa019d855ea9 100644 --- a/nixos/modules/services/logging/logstash.nix +++ b/nixos/modules/services/logging/logstash.nix @@ -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}" ]); }; }; diff --git a/pkgs/tools/misc/logstash/6.x.nix b/pkgs/tools/misc/logstash/6.x.nix deleted file mode 100644 index 4f15ba90d39d..000000000000 --- a/pkgs/tools/misc/logstash/6.x.nix +++ /dev/null @@ -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 ]; - }; -} diff --git a/pkgs/tools/misc/logstash/default.nix b/pkgs/tools/misc/logstash/default.nix index 079e5c7a93bf..4f15ba90d39d 100644 --- a/pkgs/tools/misc/logstash/default.nix +++ b/pkgs/tools/misc/logstash/default.nix @@ -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 ]; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6753ab584ab5..e44799b99845 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };