diff --git a/Gemfile.template b/Gemfile.template index 443aba33d78..4bdd32ae4ce 100644 --- a/Gemfile.template +++ b/Gemfile.template @@ -6,7 +6,6 @@ gem "logstash-core", :path => "./logstash-core" gem "logstash-core-plugin-api", :path => "./logstash-core-plugin-api" gem "paquet", "~> 0.2" -gem "pleaserun", "~>0.0.28" gem "rake", "~> 12" gem "ruby-progressbar", "~> 1" gem "logstash-output-elasticsearch", ">= 10.4.2" diff --git a/NOTICE.TXT b/NOTICE.TXT index 6cfe8a9b638..d7ea5da0b08 100644 --- a/NOTICE.TXT +++ b/NOTICE.TXT @@ -8836,23 +8836,6 @@ You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -========== -Notice for: pleaserun-0.0.32 ----------- - -Copyright 2014 Jordan Sissel contributors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bin/system-install b/bin/system-install deleted file mode 100755 index 7a2d3730084..00000000000 --- a/bin/system-install +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -unset CDPATH -. "$(cd `dirname $0`/..; pwd)/bin/logstash.lib.sh" -setup - -if [ -z "$1" ]; then - if [ -r /etc/logstash/startup.options ]; then - OPTIONS_PATH=/etc/logstash/startup.options - elif [ -r "${LOGSTASH_HOME}"/config/startup.options ]; then - OPTIONS_PATH="${LOGSTASH_HOME}"/config/startup.options - fi -elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then - echo "Usage: system-install [OPTIONSFILE] [STARTUPTYPE] [VERSION]" - echo - echo "NOTE: These arguments are ordered, and co-dependent" - echo - echo "OPTIONSFILE: Full path to a startup.options file" - echo "OPTIONSFILE is required if STARTUPTYPE is specified, but otherwise looks first" - echo "in /etc/logstash/startup.options and then " - echo "in $LOGSTASH_HOME/config/startup.options " - echo - echo "STARTUPTYPE: e.g. sysv, upstart, systemd, etc." - echo "OPTIONSFILE is required to specify a STARTUPTYPE." - echo - echo "VERSION: The specified version of STARTUPTYPE to use. The default is usually" - echo "preferred here, so it can safely be omitted." - echo "Both OPTIONSFILE & STARTUPTYPE are required to specify a VERSION." - echo - echo "For more information, see https://github.com/jordansissel/pleaserun" - exit 0 -else - if [ -r "$1" ]; then - echo "Using provided startup.options file: ${1}" - OPTIONS_PATH="$1" - else - echo "$1 is not a file path" - echo "To manually specify a startup style, put the path to startup.options as the " - echo "first argument, followed by the startup style (sysv, upstart, systemd)" - exit 1 - fi -fi - -# Read in the env vars in the selected startup.options file... -. "${OPTIONS_PATH}" - -old_IFS=$IFS -IFS=$'\n' -lines=($(grep -v ^# ${OPTIONS_PATH} | tr -d '"' | grep -v '^LS_OPTS=' | grep \= | grep -v '\=$' | grep -v '\=\"\"$')) -IFS=$old_IFS - -ENV_VAR_ARGS=() - -for line in ${lines[@]}; do - var=$(echo $line | awk -F\= '{print $1}') - if [ "x${!var}" != "x" ]; then - ENV_VAR_ARGS+=('--environment-variables') - ENV_VAR_ARGS+=("${var}=${!var}") - fi -done - -# bin/logstash-plugin is a short lived ruby script thus we can use aggressive "faster starting JRuby options" -# see https://github.com/jruby/jruby/wiki/Improving-startup-time -export JRUBY_OPTS="$JRUBY_OPTS $OPEN_JAVA_MODULES -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -X-C -Xcompile.invokedynamic=false" - -tempfile=$(mktemp) -if [ "x${PRESTART}" == "x" ]; then - opts=("--log" "$tempfile" "--overwrite" "--install" "--name" "${SERVICE_NAME}" "--user" "${LS_USER}" "--group" "${LS_GROUP}" "--description" "${SERVICE_DESCRIPTION}" "--nice" "${LS_NICE}" "--limit-open-files" "${LS_OPEN_FILES}") -else - opts=("--log" "$tempfile" "--overwrite" "--install" "--name" "${SERVICE_NAME}" "--user" "${LS_USER}" "--group" "${LS_GROUP}" "--description" "${SERVICE_DESCRIPTION}" "--nice" "${LS_NICE}" "--limit-open-files" "${LS_OPEN_FILES}" "--prestart" "${PRESTART}") -fi - -if [[ $2 ]]; then - echo "Manually creating startup for specified platform: ${2}" - opts+=('--platform') - opts+=($2) -fi - -if [[ $3 ]]; then - echo "Manually creating startup for specified platform (${2}) version: ${3}" - opts+=('--version') - opts+=($3) -fi - -allopts=("${ENV_VAR_ARGS[@]}" "${opts[@]}") -program="$(cd `dirname $0`/..; pwd)/bin/logstash" - -$(ruby_exec "${LOGSTASH_HOME}/lib/systeminstall/pleasewrap.rb" "${allopts[@]}" ${program} ${LS_OPTS}) -exit_code=$? - -if [ $exit_code -ne 0 ]; then - cat $tempfile - echo "Unable to install system startup script for Logstash." -else - echo "Successfully created system startup script for Logstash" -fi -rm $tempfile - -exit $exit_code diff --git a/config/startup.options b/config/startup.options deleted file mode 100644 index 3829fdb9b5e..00000000000 --- a/config/startup.options +++ /dev/null @@ -1,53 +0,0 @@ -################################################################################ -# These settings are ONLY used by $LS_HOME/bin/system-install to create a custom -# startup script for Logstash and is not used by Logstash itself. It should -# automagically use the init system (systemd, upstart, sysv, etc.) that your -# Linux distribution uses. -# -# After changing anything here, you need to re-run $LS_HOME/bin/system-install -# as root to push the changes to the init script. -################################################################################ - -# Override Java location -#JAVACMD=/usr/bin/java - -# Set a home directory -LS_HOME=/usr/share/logstash - -# logstash settings directory, the path which contains logstash.yml -LS_SETTINGS_DIR=/etc/logstash - -# Arguments to pass to logstash -LS_OPTS="--path.settings ${LS_SETTINGS_DIR}" - -# Arguments to pass to java -LS_JAVA_OPTS="" - -# pidfiles aren't used the same way for upstart and systemd; this is for sysv users. -LS_PIDFILE=/var/run/logstash.pid - -# user and group id to be invoked as -LS_USER=logstash -LS_GROUP=logstash - -# Enable GC logging by uncommenting the appropriate lines in the GC logging -# section in jvm.options -LS_GC_LOG_FILE=/var/log/logstash/gc.log - -# Open file limit -LS_OPEN_FILES=16384 - -# Nice level -LS_NICE=19 - -# Change these to have the init script named and described differently -# This is useful when running multiple instances of Logstash on the same -# physical box or vm -SERVICE_NAME="logstash" -SERVICE_DESCRIPTION="logstash" - -# If you need to run a command or script before launching Logstash, put it -# between the lines beginning with `read` and `EOM`, and uncomment those lines. -### -## read -r -d '' PRESTART << EOM -## EOM diff --git a/docs/static/setting-up-logstash.asciidoc b/docs/static/setting-up-logstash.asciidoc index be3f221f360..44323890f86 100644 --- a/docs/static/setting-up-logstash.asciidoc +++ b/docs/static/setting-up-logstash.asciidoc @@ -91,7 +91,7 @@ locations for the system: d| | settings - | Configuration files, including `logstash.yml`, `jvm.options`, and `startup.options` + | Configuration files, including `logstash.yml` and `jvm.options` | `/etc/logstash` | `path.settings` @@ -115,6 +115,11 @@ locations for the system: | `/var/lib/logstash` | `path.data` +| start-up options + | File used by the Logstash daemon to define the default start-up options. + | `/etc/default/logstash` + d| + |======================================================================= [[docker-layout]] @@ -193,11 +198,3 @@ The settings files are already defined in the Logstash installation. Logstash in Specify each flag on a separate line. All other settings in this file are considered expert settings. *`log4j2.properties`*:: Contains default settings for `log4j 2` library. See <> for more info. -*`startup.options` (Linux)*:: - Contains options used by the `system-install` script in `/usr/share/logstash/bin` to build the appropriate startup - script for your system. When you install the Logstash package, the `system-install` script executes at the end of the - installation process and uses the settings specified in `startup.options` to set options such as the user, group, - service name, and service description. By default, Logstash services are installed under the user `logstash`. The `startup.options` file makes it easier for you to install multiple instances of the Logstash service. You can copy - the file and change the values for specific settings. Note that the `startup.options` file is not read at startup. If - you want to change the Logstash startup script (for example, to change the Logstash user or read from a different - configuration path), you must re-run the `system-install` script (as root) to pass in the new settings. diff --git a/lib/systeminstall/pleasewrap.rb b/lib/systeminstall/pleasewrap.rb deleted file mode 100755 index 026bf836619..00000000000 --- a/lib/systeminstall/pleasewrap.rb +++ /dev/null @@ -1,28 +0,0 @@ -# Licensed to Elasticsearch B.V. under one or more contributor -# license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright -# ownership. Elasticsearch B.V. licenses this file to you under -# the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. - -$LOAD_PATH.unshift(File.expand_path(File.join(__FILE__, "..", ".."))) - -require "bootstrap/environment" - -ENV["GEM_HOME"] = ENV["GEM_PATH"] = LogStash::Environment.logstash_gem_home -Gem.use_paths(LogStash::Environment.logstash_gem_home) - -#libdir = File.expand_path("../lib", File.dirname(__FILE__)) -#$LOAD_PATH << libdir if File.exist?(File.join(libdir, "pleaserun", "cli.rb")) -require "pleaserun/cli" -exit(PleaseRun::CLI.run || 0) diff --git a/pkg/centos/after-install.sh b/pkg/centos/after-install.sh index 9fc1b0f9bc5..08b70a53b1d 100644 --- a/pkg/centos/after-install.sh +++ b/pkg/centos/after-install.sh @@ -5,6 +5,5 @@ sed -i \ -e 's|# path.logs:|path.logs: /var/log/logstash|' \ -e 's|# path.data:|path.data: /var/lib/logstash|' \ /etc/logstash/logstash.yml -chmod 600 /etc/logstash/startup.options chmod 600 /etc/default/logstash diff --git a/pkg/centos/before-install.sh b/pkg/centos/before-install.sh index e891ce13d30..2bf2eedcaab 100644 --- a/pkg/centos/before-install.sh +++ b/pkg/centos/before-install.sh @@ -9,7 +9,13 @@ if ! getent passwd logstash >/dev/null; then -s /sbin/nologin -c "logstash" logstash fi -# Handle upgrade: Check if old service unit exists and remove it +# Handle upgrade +## Check if old service unit exists and remove it if [ -f /etc/systemd/system/logstash.service ]; then rm -rf /etc/systemd/system/logstash.service || true fi + +## Check if startup.options file exists and remote it +if [ -f /etc/logstash/startup.options ]; then + rm -rf /etc/logstash/startup.options || true +fi diff --git a/pkg/debian/after-install.sh b/pkg/debian/after-install.sh index 51ea473b0ee..6f9dd0eea38 100644 --- a/pkg/debian/after-install.sh +++ b/pkg/debian/after-install.sh @@ -8,6 +8,5 @@ sed -i \ -e 's|# path.logs:|path.logs: /var/log/logstash|' \ -e 's|# path.data:|path.data: /var/lib/logstash|' \ /etc/logstash/logstash.yml -chmod 600 /etc/logstash/startup.options chmod 600 /etc/default/logstash diff --git a/pkg/debian/before-install.sh b/pkg/debian/before-install.sh index 43bc375353e..6950f266c5f 100644 --- a/pkg/debian/before-install.sh +++ b/pkg/debian/before-install.sh @@ -11,7 +11,13 @@ if ! getent passwd logstash >/dev/null; then -s /usr/sbin/nologin -c "LogStash Service User" logstash fi -# Handle upgrade: Check if old service unit exists and remove it +# Handle upgrade +## Check if old service unit exists and remove it if [ -f /etc/systemd/system/logstash.service ]; then rm -rf /etc/systemd/system/logstash.service || true fi + +## Check if startup.options file exists and remote it +if [ -f /etc/logstash/startup.options ]; then + rm -rf /etc/logstash/startup.options || true +fi diff --git a/pkg/ubuntu/after-install.sh b/pkg/ubuntu/after-install.sh index c1a22fe8382..5cdcd7e8e4d 100644 --- a/pkg/ubuntu/after-install.sh +++ b/pkg/ubuntu/after-install.sh @@ -7,5 +7,4 @@ sed -i \ -e 's|# path.logs:|path.logs: /var/log/logstash|' \ -e 's|# path.data:|path.data: /var/lib/logstash|' \ /etc/logstash/logstash.yml -chmod 600 /etc/logstash/startup.options chmod 600 /etc/default/logstash diff --git a/pkg/ubuntu/before-install.sh b/pkg/ubuntu/before-install.sh index 43bc375353e..6950f266c5f 100644 --- a/pkg/ubuntu/before-install.sh +++ b/pkg/ubuntu/before-install.sh @@ -11,7 +11,13 @@ if ! getent passwd logstash >/dev/null; then -s /usr/sbin/nologin -c "LogStash Service User" logstash fi -# Handle upgrade: Check if old service unit exists and remove it +# Handle upgrade +## Check if old service unit exists and remove it if [ -f /etc/systemd/system/logstash.service ]; then rm -rf /etc/systemd/system/logstash.service || true fi + +## Check if startup.options file exists and remote it +if [ -f /etc/logstash/startup.options ]; then + rm -rf /etc/logstash/startup.options || true +fi diff --git a/rakelib/artifacts.rake b/rakelib/artifacts.rake index 3b160d1ba09..34b3f9f5f82 100644 --- a/rakelib/artifacts.rake +++ b/rakelib/artifacts.rake @@ -25,7 +25,6 @@ namespace "artifact" do PACKAGE_SUFFIX = SNAPSHOT_BUILD ? "-SNAPSHOT" : "" end - ## TODO: Install new service files def package_files [ "NOTICE.TXT", @@ -37,7 +36,6 @@ namespace "artifact" do "lib/bootstrap/**/*", "lib/pluginmanager/**/*", - "lib/systeminstall/**/*", "lib/secretstore/**/*", "logstash-core/lib/**/*", @@ -61,11 +59,6 @@ namespace "artifact" do # See more in https://github.com/elastic/logstash/issues/4818 "vendor/??*/**/.mvn/**/*", - # Without this when JRuby runs 'pleaserun' gem using the AdoptOpenJDK, during the post install script - # it claims that modules are not open for private introspection and suggest it's missing --add-opens - # so including these files JRuby run with modules opened to private introspection. - "vendor/jruby/bin/.jruby.java_opts", - "vendor/jruby/bin/.jruby.module_opts", "Gemfile", "Gemfile.lock", "x-pack/**/*", @@ -554,9 +547,6 @@ namespace "artifact" do ensure_logstash_version_constant_defined package_filename = "logstash#{suffix}-#{LOGSTASH_VERSION}#{PACKAGE_SUFFIX}-#{arch_suffix}.TYPE" - File.join(basedir, "config", "startup.options").tap do |path| - dir.input("#{path}=/etc/logstash") - end File.join(basedir, "config", "jvm.options").tap do |path| dir.input("#{path}=/etc/logstash") end @@ -592,7 +582,6 @@ namespace "artifact" do out.attributes[:rpm_user] = "root" out.attributes[:rpm_group] = "root" out.attributes[:rpm_os] = "linux" - out.config_files << "/etc/logstash/startup.options" out.config_files << "/etc/logstash/jvm.options" out.config_files << "/etc/logstash/log4j2.properties" out.config_files << "/etc/logstash/logstash.yml" @@ -611,7 +600,6 @@ namespace "artifact" do out.attributes[:deb_user] = "root" out.attributes[:deb_group] = "root" out.attributes[:deb_suggests] = ["java11-runtime-headless"] unless bundle_jdk - out.config_files << "/etc/logstash/startup.options" out.config_files << "/etc/logstash/jvm.options" out.config_files << "/etc/logstash/log4j2.properties" out.config_files << "/etc/logstash/logstash.yml" diff --git a/tools/dependencies-report/src/main/resources/licenseMapping.csv b/tools/dependencies-report/src/main/resources/licenseMapping.csv index 00944eb568f..96df497eac8 100644 --- a/tools/dependencies-report/src/main/resources/licenseMapping.csv +++ b/tools/dependencies-report/src/main/resources/licenseMapping.csv @@ -126,7 +126,6 @@ dependency,dependencyUrl,licenseOverride,copyright,sourceURL "org.reflections:reflections:",https://github.com/ronmamo/reflections,BSD-2-Clause "org.slf4j:slf4j-api:",http://www.slf4j.org/,MIT "paquet:",https://github.com/elastic/logstash,Apache-2.0 -"pleaserun:",https://github.com/jordansissel/pleaserun,Apache-2.0 "polyglot:",http://github.com/cjheath/polyglot,MIT "pry:",http://pryrepl.org,MIT "public_suffix:",https://simonecarletti.com/code/publicsuffix-ruby,MIT