forked from elastic/logstash
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update existing packaging to use /usr/lib/logstash
Update after-install scripts Use /usr/lib/logstash instead of /opt/logstash More revisions. Using `/usr/share/logstash` instead of `/usr/lib/logstash` Track these new files More work in progress. Proper arg parsing obtained WIP: Use jvm.options like ES Remove facter dependency Due to an update from @jordansissel on pleaserun, facter is no longer necessary Revert Gemfile to proper version Latest work in progress. I added a simple test to logstash.lib.sh to catch empty strings in java options. Added `startup.options`, and touched up `jvm.options` Edited the package scripts to make things play nice with new paths. Tweaked `system-install` to allow users to provide their own `startup.options` file. Patch up merge failure Changes to work with the new logstash.yml Add fpm dependency (build fails without it) Fix missing gems in Gemfile Don't know how these got lost Use /etc/logstash for configuration in packages Update the instructions/documentation for... ...startup.options Merging proposed changes Remove mustache and clamp They're covered by pleaserun anyway Prune config dir from /usr/share/logstash... ...but only when using RPM/DEB packages Fixes elastic#5341
- Loading branch information
Showing
25 changed files
with
562 additions
and
675 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
unset CDPATH | ||
. "$(cd `dirname $0`/..; pwd)/bin/logstash.lib.sh" | ||
setup | ||
|
||
if [ -z "$1" ]; then | ||
[ -r ${LOGSTASH_HOME}/config/startup.options ] && . ${LOGSTASH_HOME}/config/startup.options | ||
[ -r /etc/logstash/startup.options ] && . /etc/logstash/startup.options | ||
else | ||
if [ -r $1 ]; then | ||
echo "Using provided startup.options file: ${1}" | ||
. $1 | ||
else | ||
echo "$1 is not a file path" | ||
fi | ||
fi | ||
|
||
# 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 -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 | ||
|
||
program="$(cd `dirname $0`/..; pwd)/bin/logstash" | ||
|
||
$(ruby_exec "${LOGSTASH_HOME}/lib/systeminstall/pleasewrap.rb" "${opts[@]}" ${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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
## JVM configuration | ||
|
||
# Xms represents the initial size of total heap space | ||
# Xmx represents the maximum size of total heap space | ||
|
||
-Xms256m | ||
-Xmx1g | ||
|
||
################################################################ | ||
## Expert settings | ||
################################################################ | ||
## | ||
## All settings below this section are considered | ||
## expert settings. Don't tamper with them unless | ||
## you understand what you are doing | ||
## | ||
################################################################ | ||
|
||
## GC configuration | ||
-XX:+UseParNewGC | ||
-XX:+UseConcMarkSweepGC | ||
-XX:CMSInitiatingOccupancyFraction=75 | ||
-XX:+UseCMSInitiatingOccupancyOnly | ||
|
||
## optimizations | ||
|
||
# disable calls to System#gc | ||
-XX:+DisableExplicitGC | ||
|
||
## Locale | ||
# Set the locale language | ||
#-Duser.language=en | ||
|
||
# Set the locale country | ||
#-Duser.country=US | ||
|
||
# Set the locale variant, if any | ||
#-Duser.variant= | ||
|
||
## basic | ||
|
||
# set the I/O temp directory | ||
-Djava.io.tmpdir=$HOME | ||
|
||
# set to headless, just in case | ||
-Djava.awt.headless=true | ||
|
||
# ensure UTF-8 encoding by default (e.g. filenames) | ||
-Dfile.encoding=UTF-8 | ||
|
||
# use our provided JNA always versus the system one | ||
#-Djna.nosys=true | ||
|
||
## heap dumps | ||
|
||
# generate a heap dump when an allocation from the Java heap fails | ||
# heap dumps are created in the working directory of the JVM | ||
-XX:+HeapDumpOnOutOfMemoryError | ||
|
||
# specify an alternative path for heap dumps | ||
# ensure the directory exists and has sufficient space | ||
#-XX:HeapDumpPath=${LOGSTASH_HOME}/heapdump.hprof | ||
|
||
## GC logging | ||
#-XX:+PrintGCDetails | ||
#-XX:+PrintGCTimeStamps | ||
#-XX:+PrintGCDateStamps | ||
#-XX:+PrintClassHistogram | ||
#-XX:+PrintTenuringDistribution | ||
#-XX:+PrintGCApplicationStoppedTime | ||
|
||
# log GC status to a file with time stamps | ||
# ensure the directory exists | ||
#-Xloggc:${LS_GC_LOG_FILE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
################################################################################ | ||
# These settings are ONLY used by $LS_HOME/bin/system-install to create a custom | ||
# startup script for Logstash. 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="${LS_HOME}/config" | ||
|
||
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# encoding: utf-8 | ||
$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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
/sbin/chkconfig --add logstash | ||
# /sbin/chkconfig --add logstash | ||
|
||
chown -R logstash:logstash /opt/logstash | ||
chown -R logstash:logstash /usr/share/logstash | ||
chown logstash /var/log/logstash | ||
chown logstash:logstash /var/lib/logstash | ||
chmod 0644 /etc/logrotate.d/logstash | ||
/usr/share/logstash/bin/system-install /etc/logstash/startup.options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
#!/bin/sh | ||
|
||
chown -R logstash:logstash /opt/logstash | ||
chown -R logstash:logstash /usr/share/logstash | ||
chown logstash /var/log/logstash | ||
chown logstash:logstash /var/lib/logstash | ||
chmod 755 /etc/logstash | ||
chmod 0644 /etc/logrotate.d/logstash | ||
/usr/share/logstash/bin/system-install /etc/logstash/startup.options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.