Merge pull request #1103 from fayep/pkgbuilding

Add tarball based packages. Fix environment passing in bin/logstash.
This commit is contained in:
Richard Pijnenburg 2014-02-25 18:41:00 +00:00
commit 375ca210ac
44 changed files with 391 additions and 1367 deletions

View file

@ -427,13 +427,10 @@ releaseNote:
$(QUIET)curl -si "https://logstash.jira.com/secure/ReleaseNote.jspa?version=$(JIRA_VERSION_ID)&projectId=10020" | sed -n '/<textarea.*>/,/<\/textarea>/p' | grep textarea -v >> releaseNote.html
$(QUIET)ruby pull_release_note.rb
package:
[ ! -f build/logstash-$(VERSION)-flatjar.jar ] \
&& make build/logstash-$(VERSION)-flatjar.jar ; \
package: build/logstash-$(VERSION).tar.gz
(cd pkg; \
./build.sh ubuntu 12.10; \
./build.sh centos 6; \
./build.sh debian 6; \
./build.sh ubuntu 12.04; \
./build.sh centos 6 \
)
vendor/kibana: | vendor

View file

@ -24,6 +24,9 @@ basedir=$(cd `dirname $0`/..; pwd)
setup
# Export these so that they can be picked up by file input (and others?).
export HOME SINCEDB_DIR
case $1 in
deps) install_deps ;;
-*)

View file

@ -1,5 +1,5 @@
#!/bin/bash
# We only need to build two packages now, rpm and deb. Leaving the os/version stuff in case things change.
[ ! -f ../.VERSION.mk ] && make -C .. .VERSION.mk
@ -12,7 +12,6 @@ if ! git show-ref --tags | grep -q "$(git rev-parse HEAD)"; then
RPM_REVISION=".${BUILD_TIME}.${REVISION}"
fi
URL="http://logstash.net"
DESCRIPTION="An extensible logging pipeline"
@ -37,18 +36,17 @@ fi
mkdir -p $destdir/$prefix
# install logstash.jar
jar="$(dirname $0)/../build/logstash-$VERSION-flatjar.jar"
if [ ! -f "$jar" ] ; then
echo "Unable to find $jar"
exit 1
# Deploy the tarball to /opt/logstash
tar="$(dirname $0)/../build/logstash-$VERSION.tar.gz"
if [ ! -f "$tar" ] ; then
echo "Unable to find $tar"
exit 1
fi
cp $jar $destdir/$prefix/logstash.jar
tar -C $destdir/$prefix --strip-components 1 -zxpf $tar
case $os@$release in
centos@*)
centos@*|fedora@*|el6@*|sl6@*)
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/sysconfig
mkdir -p $destdir/etc/init.d
@ -57,27 +55,17 @@ case $os@$release in
mkdir -p $destdir/var/lib/logstash
mkdir -p $destdir/var/run/logstash
mkdir -p $destdir/var/log/logstash
cp $os/sysconfig $destdir/etc/sysconfig/logstash
chmod 0755 $destdir/opt/logstash/bin/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/logstash
install -m644 logstash.default $destdir/etc/sysconfig/logstash
install -m755 logstash.sysv.redhat $destdir/etc/init.d/logstash
install -m644 logstash-web.default $destdir/etc/sysconfig/logstash
install -m755 logstash-web.sysv.redhat $destdir/etc/init.d/logstash-web
;;
ubuntu@*)
ubuntu@*|debian@*)
mkdir -p $destdir/etc/logstash/conf.d
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/init
mkdir -p $destdir/var/lib/logstash
mkdir -p $destdir/var/log/logstash
mkdir -p $destdir/etc/default
touch $destdir/etc/default/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/logstash
install -m644 logstash.default $destdir/etc/default/logstash
install -m644 logstash-web.default $destdir/etc/default/logstash-web
install -m755 logstash.upstart.ubuntu $destdir/etc/init/logstash.conf
install -m755 logstash-web.upstart.ubuntu $destdir/etc/init/logstash-web.conf
;;
debian@*)
mkdir -p $destdir/etc/logstash/conf.d
mkdir -p $destdir/etc/logrotate.d
mkdir -p $destdir/etc/init.d
mkdir -p $destdir/var/lib/logstash
mkdir -p $destdir/var/log/logstash
@ -85,8 +73,10 @@ case $os@$release in
touch $destdir/etc/default/logstash
install -m644 logrotate.conf $destdir/etc/logrotate.d/logstash
install -m644 logstash.default $destdir/etc/default/logstash
install -m644 logstash-web.default $destdir/etc/default/logstash-web
install -m755 logstash.upstart.ubuntu $destdir/etc/init/logstash.conf
install -m755 logstash.sysv.debian $destdir/etc/init.d/logstash
install -m644 logstash-web.default $destdir/etc/default/logstash-web
install -m755 logstash-web.upstart.ubuntu $destdir/etc/init/logstash-web.conf
install -m755 logstash-web.sysv.debian $destdir/etc/init.d/logstash-web
;;
*)
@ -97,14 +87,16 @@ esac
description="logstash is a system for managing and processing events and logs"
case $os in
centos|fedora|redhat)
centos|fedora|redhat|sl)
fpm -s dir -t rpm -n logstash -v "$RELEASE" \
-a noarch --iteration "1_${os}${RPM_REVISION}" \
-a noarch --iteration "1_${RPM_REVISION}" \
--url "$URL" \
--description "$DESCRIPTION" \
-d "jre >= 1.6.0" \
--vendor "Elasticsearch" \
--license "Apache 2.0" \
--rpm-use-file-permissions \
--rpm-user root --rpm-group root \
--before-install centos/before-install.sh \
--before-remove centos/before-remove.sh \
--after-install centos/after-install.sh \
@ -121,12 +113,12 @@ case $os in
fi
fpm -s dir -t deb -n logstash -v "$RELEASE" \
-a all --iteration "1-${os}${DEB_REVISION}" \
-a all --iteration "1-${DEB_REVISION}" \
--url "$URL" \
--description "$DESCRIPTION" \
--vendor "Elasticsearch" \
--license "Apache 2.0" \
-d "java7-runtime-headless | java6-runtime-headless" \
-d "java7-runtime-headless | java6-runtime-headless | j2re1.7" \
--deb-user root --deb-group root \
--before-install $os/before-install.sh \
--before-remove $os/before-remove.sh \

View file

@ -1 +1,5 @@
/sbin/chkconfig --add logstash
chown -R logstash:logstash /opt/logstash
chown logstash /var/log/logstash
chown logstash:logstash /var/lib/logstash

View file

@ -1,15 +0,0 @@
# Set 'START' to true to have logstash start.
START=false
# The 'ulimit -n' setting for logstash.
# You may need to increase this if you are using
# the elasticsearch output with 'embedded => true'
#OPEN_FILES=16384
# How many filter workers to run.
# Note this requires you use thread-safe filters
#FILTER_THREADS=1
# The flags to provide to java
#LS_JAVA_OPTS="-Xmx256m -Djava.io.tmpdir=$LS_HOME/tmp"

View file

@ -10,4 +10,3 @@ if ! getent passwd logstash >/dev/null; then
useradd -M -r -g logstash -d /var/lib/logstash \
-s /sbin/nologin -c "LogStash Service User" logstash
fi

View file

@ -1,7 +1,7 @@
#!/bin/sh
if [ $1 = "remove" ]; then
/etc/init.d/logstash stop >/dev/null 2>&1 || true
service logstash stop >/dev/null 2>&1 || true
if getent passwd logstash >/dev/null ; then
userdel logstash

View file

@ -1,34 +0,0 @@
#!/bin/bash -ex
# The MIT License
#
# Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Jamie Whitehouse
# Modified in 2013 by Corey Quinn for logstash.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
if [ -z "$1" ]; then
echo "Usage: build.sh path/to/logstash.jar"
exit 1
fi
d=$(dirname $0)
cp "$1" $d/logstash.jar
cd $d
exec debuild -us -uc -B

View file

@ -1,6 +0,0 @@
The Debian Package logstash
----------------------------
Comments regarding the Package
-- Corey Quinn <corey@sequestered.net> Sun, 24 Feb 2013 18:24:41 -0800

View file

@ -1,17 +0,0 @@
logstash (1.1.10.dev~1) unstable; urgency=low
* Dev builds of master.
-- Jordan Sissel <jls@semicomplete.com> Tue, 2 Apr 2013 21:55:33 -0700
logstash (1.1.9~1) unstable; urgency=low
* Depend on openjdk. Don't start daemon by default.
-- Rudy Gevaert <Rudy.Gevaert@UGent.be> Wed, 27 Feb 2013 21:54:41 +0100
logstash (1.1.9) unstable; urgency=low
* Initial packaging release
-- Corey Quinn <corey@sequestered.net> Sun, 24 Feb 2013 18:24:41 -0800

View file

@ -1 +0,0 @@
5

View file

@ -1,16 +0,0 @@
Source: logstash
Section: devel
Priority: extra
Maintainer: Corey Quinn <corey@sequestered.net>
Build-Depends: debhelper (>= 5)
Standards-Version: 3.7.2
Homepage: http://logstash.net
Package: logstash
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, daemon, adduser, psmisc, default-jre
Description: tool for managing events and logs
logstash is a tool for managing events and logs. You can use it to collect logs,
parse them, and store them for later use (like, for searching). Speaking of
searching, logstash comes with a web interface for searching and drilling into
all of your logs.

View file

@ -1,27 +0,0 @@
This package was debianized by Corey Quinn <corey@sequestered.net>.
License:
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
On Debian systems, the complete text of the GNU General
Public License can be found in `/usr/share/common-licenses/GPL'.
The Debian packaging is (C) 2013, Corey Quinn <corey@sequestered.net> and
is licensed under the GPL, see above.
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.

View file

@ -1,19 +0,0 @@
# moved from rules install
usr/share/logstash
# this is where LS_HOME is stored, so let's leave it as is for now
var/lib/logstash
# Need to create logstash's own directory to track the pid since the daemon is not run as root
# and doesn't have permission to write the pid to /var/run (which would be the preferred location).
var/run/logstash
# Store logstash log file in it's own directory since they can become rather large and in the future
# rotating logs can be easily added.
var/log/logstash
# Cache directory for the unpacked logstash.jar file.
var/cache/logstash
# Temp dir for java
var/logstash/

View file

View file

@ -1,39 +0,0 @@
# defaults for logstash
# Start logstash on boot?
START=no
# pulled in from the init script; makes things easier.
NAME=logstash
# location of java
JAVA=/usr/bin/java
# arguments to pass to java
LS_JAVA_OPTS="-Xmx256m -Djava.io.tmpdir=/var/lib/logstash/"
PIDFILE=/var/run/logstash.pid
# user id to be invoked as
LS_USER=logstash
# location of the logstas jar file
LS_JAR=/usr/share/logstash/logstash.jar
# logstash home location
LS_HOME=/var/lib/logstash
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# Open file limit
OPEN_FILES=2048
# Nice level
NICE=19

View file

@ -1,201 +0,0 @@
#!/bin/bash
#
# /etc/init.d/logstash -- startup script for LogStash.
#
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts logstash
# Description: Starts logstash using start-stop-daemon
### END INIT INFO
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=logstash
DESC="Logstash Daemon"
DEFAULT=/etc/default/$NAME
if [ `id -u` -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
. /lib/lsb/init-functions
if [ -r /etc/default/rcS ]; then
. /etc/default/rcS
fi
# The following variables can be overwritten in $DEFAULT
# Run logstash as this user ID and group ID
LS_USER=logstash
LS_GROUP=logstash
JAVA=/usr/bin/java
# Directory where the logstash all in one jar lives
LS_HOME=/var/lib/logstash
# Additional Java OPTS
LS_JAVA_OPTS=" -Djava.io.tmpdir=/var/logstash/"
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# Open File limit
OPEN_FILES=2048
# Nice level
NICE=19
# End of variables that can be overwritten in $DEFAULT
# overwrite settings from default file
if [ -f "$DEFAULT" ]; then
. "$DEFAULT"
fi
# Define other required variables
PID_FILE=/var/run/$NAME.pid
DAEMON=$LS_JAR
DAEMON_OPTS="agent -f ${CONF_DIR} --log ${LOG_FILE}"
is_true() {
if [ "x$1" = "xtrue" -o "x$1" = "xyes" -o "x$1" = "x1" ] ; then
return 0
else
return 1
fi
}
# Check DAEMON exists
if ! test -e $DAEMON; then
log_failure_msg "Daemon $DAEMON doesn't exist"
exit 1
fi
case "$1" in
start)
if ! is_true "$START" ; then
echo "logstash not configured to start, please edit /etc/default/logstash to enable"
exit 0
fi
if [ -z "$JAVA" ]; then
log_failure_msg "no JDK found - $JAVA"
exit 1
fi
# Check if a config file exists
if ! test -e $CONF_DIR/*.conf; then
log_failure_msg "There aren't any configuration files in $CONF_DIR"
exit 1
fi
log_daemon_msg "Starting $DESC"
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
# Prepare environment
ulimit -n $OPEN_FILES
# Start Daemon
start-stop-daemon --start -b --user "$LS_USER" -c "$LS_USER":"$LS_GROUP" \
-d "$LS_HOME" --pidfile "$PID_FILE" --make-pidfile \
--exec "$JAVA" -- $LS_JAVA_OPTS -jar $DAEMON $DAEMON_OPTS
sleep 1
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
if [ -f "$PID_FILE" ]; then
rm -f "$PID_FILE"
fi
log_end_msg 1
else
log_end_msg 0
fi
else
log_progress_msg "(already running)"
log_end_msg 0
fi
;;
stop)
log_daemon_msg "Stopping $DESC"
set +e
if [ -f "$PID_FILE" ]; then
start-stop-daemon --stop --pidfile "$PID_FILE" \
--user "$LS_USER" \
--retry=TERM/20/KILL/5 >/dev/null
if [ $? -eq 1 ]; then
log_progress_msg "$DESC is not running but pid file exists, cleaning up"
elif [ $? -eq 3 ]; then
PID="`cat $PID_FILE`"
log_failure_msg "Failed to stop $DESC (pid $PID)"
exit 1
fi
rm -f "$PID_FILE"
else
log_progress_msg "(not running)"
fi
log_end_msg 0
set -e
;;
status)
set +e
start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null 2>&1
if [ "$?" = "0" ]; then
if [ -f "$PID_FILE" ]; then
log_success_msg "$DESC is not running, but pid file exists."
exit 1
else
log_success_msg "$DESC is not running."
exit 3
fi
else
log_success_msg "$DESC is running with pid `cat $PID_FILE`"
fi
set -e
;;
restart|force-reload)
if [ -f "$PID_FILE" ]; then
$0 stop
sleep 1
fi
$0 start
;;
*)
log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0

View file

@ -1 +0,0 @@
logstash.jar usr/share/logstash

View file

@ -1,9 +0,0 @@
/var/log/logstash/logstash.log {
weekly
copytruncate
missingok
rotate 52
compress
delaycompress
notifempty
}

View file

@ -1,68 +0,0 @@
#!/bin/sh
# postinst script for jenkins
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
LS_GROUP=logstash
LS_USER=logstash
case "$1" in
configure)
[ -r /etc/default/logstash ] && . /etc/default/logstash
: ${LS_USER:=logstash}
# Create logstash user if it doesn't exist.
# sometimes tools that users want logstash to run need a shell,
# so use /bin/bash.
if ! getent group "$LS_GROUP" > /dev/null 2>&1 ; then
addgroup --system "$LS_GROUP" --quiet
fi
if ! id $LS_USER > /dev/null 2>&1 ; then
adduser --system --home /var/lib/logstash --no-create-home \
--ingroup $LS_GROUP --disabled-password --shell /bin/bash $LS_USER
fi
# directories needed for logstash
# we don't do -R because it can take a long time on big installation
chown $LS_USER:adm /var/lib/logstash /var/log/logstash
# we don't do "chmod 750" so that the user can choose the pemission for g and o on their own
chmod u+rwx /var/lib/logstash /var/log/logstash
# make sure logstash can delete everything in /var/cache/logstash to
# re-explode jar.
chown -R $LS_USER:adm /var/cache/logstash /var/run/logstash
chmod -R 750 /var/cache/logstash /var/run/logstash
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View file

@ -1,23 +0,0 @@
#!/bin/sh
set -e
case "$1" in
purge)
userdel logstash || true
rm -rf /var/lib/logstash /var/log/logstash \
/var/run/logstash /var/cache/logstash
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0

View file

@ -1,59 +0,0 @@
.\" Hey, EMACS: -*- nroff -*-
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH LOGSTASH SECTION "April 25, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.SH NAME
logstash \- program to do something
.SH SYNOPSIS
.B logstash
.RI [ options ] " files" ...
.br
.B bar
.RI [ options ] " files" ...
.SH DESCRIPTION
This manual page documents briefly the
.B logstash
and
.B bar
commands.
.PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
.\" respectively.
\fBlogstash\fP is a program that...
.SH OPTIONS
These programs follow the usual GNU command line syntax, with long
options starting with two dashes (`-').
A summary of options is included below.
For a complete description, see the Info files.
.TP
.B \-h, \-\-help
Show summary of options.
.TP
.B \-v, \-\-version
Show version of program.
.SH SEE ALSO
.BR bar (1),
.BR baz (1).
.br
The programs are documented fully by
.IR "The Rise and Fall of a Fooish Bar" ,
available via the Info system.
.SH AUTHOR
logstash was written by <upstream author>.
.PP
This manual page was written by Kohsuke Kawaguchi <kk@kohsuke.org>,
for the Debian project (but may be used by others).

View file

@ -1,37 +0,0 @@
#!/bin/sh
# preinst script for logstash
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
install|upgrade)
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View file

@ -1,40 +0,0 @@
#!/bin/sh
# prerm script for logstash
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <prerm> `remove'
# * <old-prerm> `upgrade' <new-version>
# * <new-prerm> `failed-upgrade' <old-version>
# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
# * <deconfigured's-prerm> `deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
remove|upgrade|deconfigure)
;;
failed-upgrade)
;;
*)
echo "prerm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View file

@ -1,5 +0,0 @@
// Used to drive apt-ftparchive
APT::FTPArchive::Release::Origin "logstash.net";
APT::FTPArchive::Release::Suite "binary";
APT::FTPArchive::Release::Architectures "all";

View file

@ -1,80 +0,0 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
configure: configure-stamp
configure-stamp:
dh_testdir
# Add here commands to configure the package.
touch configure-stamp
build: build-stamp
build-stamp: configure-stamp
dh_testdir
# Add here commands to compile the package.
touch $@
clean:
dh_testdir
dh_testroot
rm -f build-stamp configure-stamp
# Add here commands to clean up after the build process.
dh_clean
install: build
dh_testdir
dh_testroot
dh_clean -k
dh_installdirs
dh_install
# Add here commands to install the package into debian/jenkins.
# Moved creation of dirs to dirs template to be invoked by dh_installdirs
# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.
# Build architecture-dependent files here.
binary-arch: build install
dh_testdir
dh_testroot
dh_installchangelogs
dh_installdocs
dh_installexamples
# dh_installmenu
# dh_installdebconf
dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
# dh_python
dh_installinit
# dh_installcron
# dh_installinfo
dh_installman
dh_link
dh_strip
dh_compress
dh_fixperms
# dh_perl
# dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

View file

@ -1,22 +0,0 @@
# Example watch control file for uscan
# Rename this file to "watch" and then you can run the "uscan" command
# to check for upstream updates and more.
# See uscan(1) for format
# Compulsory line, this is a version 3 file
version=3
# Uncomment to examine a Webpage
# <Webpage URL> <string match>
#http://www.example.com/downloads.php jenkins-(.*)\.tar\.gz
# Uncomment to examine a Webserver directory
#http://www.example.com/pub/jenkins-(.*)\.tar\.gz
# Uncommment to examine a FTP server
#ftp://ftp.example.com/pub/jenkins-(.*)\.tar\.gz debian uupdate
# Uncomment to find new files on sourceforge, for debscripts >= 2.9
# http://sf.net/jenkins/jenkins-(.*)\.tar\.gz

View file

@ -1,38 +1,35 @@
# defaults for logstash
###############################
# Default settings for logstash
###############################
# pulled in from the init script; makes things easier.
NAME=logstash-web
# Override Java location
#JAVACMD=/usr/bin/java
# location of java
JAVA=/usr/bin/java
# Set a home directory
#LS_HOME=/var/lib/logstash
# arguments to pass to java
LS_JAVA_OPTS="-Xmx256m -Djava.io.tmpdir=/var/lib/logstash/"
# Arguments to pass to java
#LS_HEAP_SIZE="256m"
#LS_JAVA_OPTS="-Djava.io.tmpdir=$HOME"
PIDFILE=/var/run/logstash-web.pid
# Logstash filter worker threads
#LS_WORKER_THREADS=1
# user id to be invoked as
LS_USER=logstash
# pidfiles aren't used for upstart; this is for sysv users.
#LS_PIDFILE=/var/run/logstash.pid
# location of the logstas jar file
LS_JAR=/opt/logstash/logstash.jar
# user id to be invoked as; for upstart: edit /etc/init/logstash.conf
#LS_USER=logstash
# logstash home location
LS_HOME=/var/lib/logstash
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# logstash logging
#LS_LOG_FILE=/var/log/logstash/logstash-web.log
#LS_USE_GC_LOGGING="true"
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
#LS_CONF_DIR=/etc/logstash/conf.d
# Open file limit
OPEN_FILES=2048
# Open file limit; cannot be overridden in upstart
#LS_OPEN_FILES=2048
# Nice level
NICE=19
HOME=/var/lib/logstash
#LS_NICE=0

77
pkg/logstash-web.sysv.debian Executable file → Normal file
View file

@ -1,6 +1,6 @@
#!/bin/bash
#
# /etc/init.d/logstash -- startup script for LogStash.
# /etc/init.d/logstash-web -- startup script for LogStash web server.
#
### BEGIN INIT INFO
# Provides: logstash-web
@ -8,13 +8,12 @@
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the LogStash web server
# Description: Starts logstash-web using start-stop-daemon
# Short-Description: Starts logstash-web
# Description: Starts logstash web server using start-stop-daemon
### END INIT INFO
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=logstash-web
DESC="Logstash Web Server"
DEFAULT=/etc/default/$NAME
@ -31,35 +30,20 @@ if [ -r /etc/default/rcS ]; then
fi
# The following variables can be overwritten in $DEFAULT
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# Run logstash as this user ID and group ID
# See contents of file named in $DEFAULT for comments
LS_USER=logstash
LS_GROUP=logstash
JAVA=/usr/bin/java
# Directory where the logstash all in one jar lives
LS_HOME=/var/lib/logstash
# Additional Java OPTS
LS_JAVA_OPTS=" -Djava.io.tmpdir=/var/logstash/"
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# Open File limit
OPEN_FILES=2048
# Nice level
NICE=19
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=""
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=2048
LS_NICE=19
LS_OPTS=""
LS_PIDFILE=/var/run/$NAME.pid
# End of variables that can be overwritten in $DEFAULT
@ -69,46 +53,55 @@ if [ -f "$DEFAULT" ]; then
fi
# Define other required variables
PID_FILE=/var/run/$NAME.pid
DAEMON=$LS_JAR
DAEMON_OPTS="web"
[ -n "${LS_LOG_FILE}" ] && LS_OPTS="${LSOPTS} -l ${LS_LOG_FILE}"
PID_FILE=${LS_PIDFILE}
DAEMON=/opt/logstash/bin/logstash
DAEMON_OPTS="web ${LS_OPTS}"
# Check DAEMON exists
if ! test -e $DAEMON; then
log_failure_msg "Daemon $DAEMON doesn't exist"
log_failure_msg "Script $DAEMON doesn't exist"
exit 1
fi
case "$1" in
start)
if [ -z "$JAVA" ]; then
log_failure_msg "no JDK found - $JAVA"
if [ -z "$DAEMON" ]; then
log_failure_msg "no logstash script found - $DAEMON"
exit 1
fi
# Check if a config file exists
if ! test -e $CONF_DIR/*.conf; then
log_failure_msg "There aren't any configuration files in $CONF_DIR"
if [ ! "$(ls -A $LS_CONF_DIR/*.conf 2> /dev/null)" ]; then
log_failure_msg "There aren't any configuration files in $LS_CONF_DIR"
exit 1
fi
log_daemon_msg "Starting $DESC"
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
# Prepare environment
ulimit -n $OPEN_FILES
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
export PATH HOME JAVACMD JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
# Start Daemon
start-stop-daemon --start -b --user "$LS_USER" -c "$LS_USER":"$LS_GROUP" \
-d "$LS_HOME" --pidfile "$PID_FILE" --make-pidfile \
--exec "$JAVA" -- $LS_JAVA_OPTS -jar $DAEMON $DAEMON_OPTS
-d "$LS_HOME" --nicelevel "$LS_NICE" --pidfile "$PID_FILE" --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
sleep 1
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
if [ -f "$PID_FILE" ]; then
@ -153,6 +146,8 @@ case "$1" in
status)
set +e
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null 2>&1

135
pkg/logstash-web.sysv.redhat Executable file
View file

@ -0,0 +1,135 @@
#! /bin/sh
#
# /etc/rc.d/init.d/logstash-web
#
# Starts Logstash Web Server as a daemon
#
# chkconfig: 2345 90 10
# description: Starts Logstash Web Server as a daemon.
### BEGIN INIT INFO
# Provides: logstash-web
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Logstash-Web
# Description: Starts Logstash Web Server as a daemon.
### END INIT INFO
. /etc/rc.d/init.d/functions
NAME=logstash-web
DESC="Logstash Web Daemon"
DEFAULT=/etc/sysconfig/$NAME
if [ `id -u` -ne 0 ]; then
echo "You need root privileges to run this script"
exit 1
fi
# The following variables can be overwritten in $DEFAULT
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# See contents of file named in $DEFAULT for comments
LS_USER=logstash
LS_GROUP=logstash
LS_HOME=/var/lib/logstash
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=2048
LS_NICE=19
LS_OPTS=""
LS_PIDFILE=/var/run/$NAME/$NAME.pid
# End of variables that can be overwritten in $DEFAULT
if [ -f "$DEFAULT" ]; then
. "$DEFAULT"
fi
# Define other required variables
PID_FILE=${LS_PIDFILE}
test -n "${LS_LOG_FILE}" && LS_OPTS="${LS_OPTS} -l ${LS_LOG_FILE}"
DAEMON="/opt/logstash/bin/logstash"
DAEMON_OPTS="web ${LS_OPTS}"
#
# Function that starts the daemon/service
#
do_start()
{
if [ -z "$DAEMON" ]; then
echo "not found - $DAEMON"
exit 1
fi
if pidofproc -p "$PID_FILE" >/dev/null; then
failure
exit 99
fi
# Prepare environment
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
export PATH HOME JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
test -n "${JAVACMD}" && export JAVACMD
nice -n ${LS_NICE} runuser -s /bin/sh -c "exec $DAEMON $DAEMON_OPTS" ${LS_USER} > /dev/null 1>&1 < /dev/null &
RETVAL=$?
local PID=$!
# runuser forks rather than execing our process.
usleep 500000
JAVA_PID=$(ps axo ppid,pid | awk -v "ppid=$PID" '$1==ppid {print $2}')
PID=${JAVA_PID:-$PID}
echo $PID > $PID_FILE
[ $PID = $JAVA_PID ] && success
}
#
# Function that stops the daemon/service
#
do_stop()
{
killproc -p $PID_FILE $DAEMON
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${PID_FILE}
}
case "$1" in
start)
echo -n "Starting $DESC: "
do_start
touch /var/run/logstash/$NAME
;;
stop)
echo -n "Stopping $DESC: "
do_stop
rm /var/run/logstash/$NAME
;;
restart|reload)
echo -n "Restarting $DESC: "
do_stop
do_start
;;
status)
echo -n "$DESC"
status -p $PID_FILE
exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
exit 3
;;
esac
echo
exit 0

View file

@ -1,7 +1,7 @@
# logstash-web - web server
# logstash-web - web instance
#
description "logstash-web web server"
description "logstash-web agent"
start on virtual-filesystems
stop on runlevel [06]
@ -9,10 +9,41 @@ stop on runlevel [06]
# Respawn it if the process exits
respawn
# We're setting high here, we'll re-limit below.
limit nofile 65550 65550
setuid logstash
setgid logstash
# Change into a writable directory
chdir /var/lib/logstash
# You need to chdir somewhere writable because logstash needs to unpack a few
# temporary files on startup.
console log
exec /usr/bin/java -jar /opt/logstash/logstash.jar web
script
# Defaults
PATH=/bin:/usr/bin
LS_HOME=/var/lib/logstash
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=/var/log/logstash/logstash.log
LS_USE_GC_LOGGING=""
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=2048
LS_NICE=19
LS_OPTS=""
# Override our defaults with user defaults:
[ -f /etc/default/logstash-web ] && . /etc/default/logstash-web
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
[ -n "${LS_LOG_FILE}" ] && LS_OPTS="${LSOPTS} -l ${LS_LOG_FILE}"
# Reset filehandle limit
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
# Export variables
export PATH HOME JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
test -n "${JAVACMD}" && export JAVACMD
exec nice -n ${LS_NICE} /opt/logstash/bin/logstash web ${LS_OPTS}
end script

View file

@ -1,42 +1,35 @@
# defaults for logstash
###############################
# Default settings for logstash
###############################
# pulled in from the init script; makes things easier.
NAME=logstash
# location of java
JAVA=/usr/bin/java
# arguments to pass to java
LS_JAVA_OPTS="-Xmx256m -Djava.io.tmpdir=/var/lib/logstash/"
PIDFILE=/var/run/logstash.pid
# user id to be invoked as
LS_USER=logstash
# location of the logstas jar file
LS_JAR=/opt/logstash/logstash.jar
# logstash home location
LS_HOME=/var/lib/logstash
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# Open file limit
OPEN_FILES=2048
# Nice level
NICE=19
# Set LogStash options
LS_OPTS="--log ${LOG_FILE}"
# Override Java location
#JAVACMD=/usr/bin/java
# Set a home directory
HOME=/var/lib/logstash
#LS_HOME=/var/lib/logstash
# Arguments to pass to logstash agent
#LS_OPTS=""
# Arguments to pass to java
#LS_HEAP_SIZE="500m"
#LS_JAVA_OPTS="-Djava.io.tmpdir=$HOME"
# pidfiles aren't used for upstart; this is for sysv users.
#LS_PIDFILE=/var/run/logstash.pid
# user id to be invoked as; for upstart: edit /etc/init/logstash.conf
#LS_USER=logstash
# logstash logging
#LS_LOG_FILE=/var/log/logstash/logstash.log
#LS_USE_GC_LOGGING="true"
# logstash configuration directory
#LS_CONF_DIR=/etc/logstash/conf.d
# Open file limit; cannot be overridden in upstart
#LS_OPEN_FILES=16384
# Nice level
#LS_NICE=19

View file

@ -14,7 +14,6 @@
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=logstash
DESC="Logstash Daemon"
DEFAULT=/etc/default/$NAME
@ -31,36 +30,20 @@ if [ -r /etc/default/rcS ]; then
fi
# The following variables can be overwritten in $DEFAULT
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# Run logstash as this user ID and group ID
# See contents of file named in $DEFAULT for comments
LS_USER=logstash
LS_GROUP=logstash
JAVA=`which java`
# Directory where the logstash all in one jar lives
LS_HOME=/var/lib/logstash
# Additional Java OPTS
LS_JAVA_OPTS=" -Djava.io.tmpdir=/var/logstash/"
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# Open File limit
OPEN_FILES=2048
# LogStash options
LS_OPTS="--log ${LOG_DIR}/${NAME}.log"
# Nice level
NICE=19
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=/var/log/logstash/$NAME.log
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=16384
LS_NICE=19
LS_OPTS=""
LS_PIDFILE=/var/run/$NAME.pid
# End of variables that can be overwritten in $DEFAULT
@ -70,47 +53,54 @@ if [ -f "$DEFAULT" ]; then
fi
# Define other required variables
LS_JAR="/opt/logstash/logstash.jar"
PID_FILE=/var/run/$NAME.pid
DAEMON=$LS_JAR
DAEMON_OPTS="agent -f ${CONF_DIR} ${LS_OPTS}"
PID_FILE=${LS_PIDFILE}
DAEMON=/opt/logstash/bin/logstash
DAEMON_OPTS="agent -f ${LS_CONF_DIR} -l ${LS_LOG_FILE} ${LS_OPTS}"
# Check DAEMON exists
if ! test -e $DAEMON; then
log_failure_msg "Jar file $DAEMON doesn't exist"
log_failure_msg "Script $DAEMON doesn't exist"
exit 1
fi
case "$1" in
start)
if [ -z "$JAVA" ]; then
log_failure_msg "no JDK found - $JAVA"
if [ -z "$DAEMON" ]; then
log_failure_msg "no logstash script found - $DAEMON"
exit 1
fi
# Check if a config file exists
if [ ! "$(ls -A $CONF_DIR/*.conf 2> /dev/null)" ]; then
log_failure_msg "There aren't any configuration files in $CONF_DIR"
if [ ! "$(ls -A $LS_CONF_DIR/*.conf 2> /dev/null)" ]; then
log_failure_msg "There aren't any configuration files in $LS_CONF_DIR"
exit 1
fi
log_daemon_msg "Starting $DESC"
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
# Prepare environment
ulimit -n $OPEN_FILES
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
export PATH HOME JAVACMD JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
# Start Daemon
start-stop-daemon --start -b --user "$LS_USER" -c "$LS_USER":"$LS_GROUP" \
-d "$LS_HOME" --pidfile "$PID_FILE" --make-pidfile \
--exec "$JAVA" -- $LS_JAVA_OPTS -jar $DAEMON $DAEMON_OPTS
-d "$LS_HOME" --nicelevel "$LS_NICE" --pidfile "$PID_FILE" --make-pidfile \
--exec $DAEMON -- $DAEMON_OPTS
sleep 1
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
if start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null; then
if [ -f "$PID_FILE" ]; then
@ -155,6 +145,8 @@ case "$1" in
status)
set +e
# Parse the actual JAVACMD from the process' environment, we don't care about errors.
JAVA=$(cat /proc/$(cat ${PID_FILE} 2>/dev/null)/environ 2>/dev/null | awk -F= 'BEGIN {RS="\0"} /JAVACMD/ {print $2}')
start-stop-daemon --test --start --pidfile "$PID_FILE" \
--user "$LS_USER" --exec "$JAVA" \
>/dev/null 2>&1

View file

@ -5,7 +5,7 @@
# Starts Logstash as a daemon
#
# chkconfig: 2345 90 10
# description: Starts Logstash as a daemon
# description: Starts Logstash as a daemon.
### BEGIN INIT INFO
# Provides: logstash
@ -15,12 +15,10 @@
# Default-Stop: S 0 1 6
# Short-Description: Logstash
# Description: Starts Logstash as a daemon.
### END INIT INFO
. /etc/rc.d/init.d/functions
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=logstash
DESC="Logstash Daemon"
DEFAULT=/etc/sysconfig/$NAME
@ -31,32 +29,20 @@ if [ `id -u` -ne 0 ]; then
fi
# The following variables can be overwritten in $DEFAULT
PATH=/bin:/usr/bin:/sbin:/usr/sbin
export JAVA_HOME=/usr
# Directory where the logstash all in one jar lives
LS_HOME=/opt/logstash
# Additional Java OPTS
LS_JAVA_OPTS="-Xmx256m -Djava.io.tmpdir=$LS_HOME/tmp"
# logstash log directory
LOG_DIR=/var/log/logstash
# logstash configuration directory
CONF_DIR=/etc/logstash/conf.d
# logstash log file
LOG_FILE=$LOG_DIR/$NAME.log
# Open File limit
OPEN_FILES=2048
# Nice level
NICE=19
# Filter threads
FILTER_THREADS=1
# See contents of file named in $DEFAULT for comments
LS_USER=logstash
LS_GROUP=logstash
LS_HOME=/var/lib/logstash
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=/var/log/logstash/$NAME.log
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=16384
LS_NICE=19
LS_OPTS=""
LS_PIDFILE=/var/run/$NAME/$NAME.pid
# End of variables that can be overwritten in $DEFAULT
@ -65,11 +51,10 @@ if [ -f "$DEFAULT" ]; then
fi
# Define other required variables
PID_FILE=/var/run/$NAME.pid
PID_FILE=${LS_PIDFILE}
JAVA=`which java`
JAR="${LS_HOME}/logstash.jar"
ARGS="${LS_JAVA_OPTS} -jar ${JAR} agent --config ${CONF_DIR} --log ${LOG_FILE} -w ${FILTER_THREADS}"
DAEMON="/opt/logstash/bin/logstash"
DAEMON_OPTS="agent -f ${LS_CONF_DIR} -l ${LS_LOG_FILE} ${LS_OPTS}"
#
# Function that starts the daemon/service
@ -77,13 +62,8 @@ ARGS="${LS_JAVA_OPTS} -jar ${JAR} agent --config ${CONF_DIR} --log ${LOG_FILE} -
do_start()
{
if [ -z "$JAVA" ]; then
echo "no JDK found - $JAVA"
exit 1
fi
if ! test -e "${JAR}"; then
echo "Jar file $JAR doesn't exist"
if [ -z "$DAEMON" ]; then
echo "not found - $DAEMON"
exit 1
fi
@ -92,15 +72,24 @@ do_start()
exit 99
fi
ulimit -n $OPEN_FILES
# Prepare environment
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
export PATH HOME JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
test -n "${JAVACMD}" && export JAVACMD
cd $LS_HOME
$JAVA $ARGS > /dev/null 1>&1 &
nice -n ${LS_NICE} runuser -s /bin/sh -c "exec $DAEMON $DAEMON_OPTS" ${LS_USER} > /dev/null 1>&1 < /dev/null &
RETVAL=$?
local PID=$!
# runuser forks rather than execing our process.
usleep 500000
JAVA_PID=$(ps axo ppid,pid | awk -v "ppid=$PID" '$1==ppid {print $2}')
PID=${JAVA_PID:-$PID}
echo $PID > $PID_FILE
success
[ $PID = $JAVA_PID ] && success
}
#

View file

@ -9,12 +9,40 @@ stop on runlevel [06]
# Respawn it if the process exits
respawn
# We're setting high here, we'll re-limit below.
limit nofile 65550 65550
setuid logstash
setgid logstash
# You need to chdir somewhere writable because logstash needs to unpack a few
# temporary files on startup.
chdir /var/lib/logstash
console log
exec /usr/bin/java -jar /opt/logstash/logstash.jar agent -f /etc/logstash/conf.d
script
# Defaults
PATH=/bin:/usr/bin
LS_HOME=/var/lib/logstash
LS_HEAP_SIZE="500m"
LS_JAVA_OPTS="-Djava.io.tmpdir=${LS_HOME}"
LS_LOG_FILE=/var/log/logstash/logstash.log
LS_USE_GC_LOGGING=""
LS_CONF_DIR=/etc/logstash/conf.d
LS_OPEN_FILES=16384
LS_NICE=19
LS_OPTS=""
# Override our defaults with user defaults:
[ -f /etc/default/logstash ] && . /etc/default/logstash
HOME="${HOME:-$LS_HOME}"
JAVA_OPTS="${LS_JAVA_OPTS}"
# Reset filehandle limit
ulimit -n ${LS_OPEN_FILES}
cd "${LS_HOME}"
# Export variables
export PATH HOME JAVA_OPTS LS_HEAP_SIZE LS_JAVA_OPTS LS_USE_GC_LOGGING
test -n "${JAVACMD}" && export JAVACMD
exec nice -n ${LS_NICE} /opt/logstash/bin/logstash agent -f "${LS_CONF_DIR}" -l "${LS_LOG_FILE}" ${LS_OPTS}
end script

View file

@ -1,26 +0,0 @@
### THIS IS A EXAMPLE CONFIG SO LOGSTASH WILL RUN ###
### PLEASE UPDATE THIS TO WHATEVER YOU WANT TO USE ###
input {
syslog {
type => syslog
port => 5544
}
}
filter {
mutate {
add_field => [ "hostip", "%{host}" ]
}
dns {
reverse => [ "host" ]
action => "replace"
}
}
output {
elasticsearch {
host => "localhost"
}
}

View file

@ -1,80 +0,0 @@
#!/bin/bash
# chkconfig: - 80 15
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $all
# Required-Stop: $all
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: Starts logstash
# Description: Logstash agent
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
NAME=@@@NAME@@@
[ -f /etc/sysconfig/$NAME ] && . /etc/sysconfig/$NAME
LOGSTASH_USER=${NAME}
DAEMON="@@@DAEMON@@@/${NAME}"
SERVICE=agent
PID_FILE=${PIDFILE:-@@@PIDDIR@@@/${NAME}.pid}
LOCK_FILE=${LOCKFILE:-@@@LOCKFILE@@@}
LOG_FILE=${LOGFILE:-@@@LOGDIR@@@/${NAME}.log}
LOGSTASH_PATH_CONF=${LOGSTASH_PATH_CONF:-@@@CONFDIR@@@}
LOGSTASH_LOGLEVEL=${LOGSTASH_LOGLEVEL:-"warn"}
DAEMON_OPTS="\
-P ${PID_FILE} \
-l ${LOG_FILE} \
-f ${LOGSTASH_PATH_CONF} \
-v $LOGSTASH_LOGLEVEL \
"
start() {
echo -n $"Starting ${NAME}: "
export JAVA_OPTS="$JAVA_OPTS $LOGSTASH_JAVA_OPTS"
daemon --pidfile=${PID_FILE} --user $LOGSTASH_USER $DAEMON $SERVICE $DAEMON_OPTS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
return $RETVAL
}
stop() {
echo -n $"Stopping ${NAME}: "
killproc -p ${PID_FILE} -d 10 $DAEMON
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${LOCK_FILE} ${PID_FILE}
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status -p ${PID_FILE} $DAEMON
RETVAL=$?
;;
restart|force-reload)
stop
start
;;
*)
N=/etc/init.d/${NAME}
echo "Usage: $N {start|stop|restart|force-reload}" >&2
RETVAL=2
;;
esac
exit $RETVAL

View file

@ -1,8 +0,0 @@
/var/log/logstash/*.log {
daily
rotate 7
copytruncate
compress
missingok
notifempty
}

View file

@ -1,3 +0,0 @@
#LOGSTASH_LOGFILE=@@@LOGDIR@@@/@@@NAME@@@.log
#LOGSTASH_PATH_CONF=@@@CONFDIR@@@
#LOGSTASH_JAVA_OPTS="-Djava.io.tmpdir=/opt/@@@NAME@@@/tmp"

View file

@ -1,105 +0,0 @@
#!/bin/sh
SCRIPT=$0
if [ -x "$JAVA_HOME/bin/java" ]; then
JAVA=$JAVA_HOME/bin/java
else
JAVA=`which java`
fi
LOGSTASH_JAR="@@@JARPATH@@@/@@@NAME@@@.jar"
if [ ! -f $LOGSTASH_JAR ]
then
echo "jar file is not found."
exit 99
fi
function usage() {
echo "Usage: ${SCRIPT} SERVICE OPTIONS"
echo " SERVICE: agent, web"
echo " OPTIONS:"
echo -e " -f, --config CONFIGFILE (required)\tLoad the logstash config from a specific file or directory."
echo -e " \t\tIf a direcory is given instead of a file, all files in that directory will be concatonated in lexicographical order and then parsed as a single config file."
echo -e " -P, --pidfile PIDFILE\t\tPID file path."
echo -e " -l, --logfile LOGFILE\t\tLogfile path."
echo -e " -v, --verbose [info, debug]\t\tEnables more verbose logging"
}
function run_service() {
service=$1
config=$2
pidfile=$3
logfile=$4
verbose=$5
if [ "x$logfile" == "x" ]; then
exec "$JAVA" $JAVA_OPTS -jar $LOGSTASH_JAR $service $verbose -f "$config" &
rs=$?
else
exec "$JAVA" $JAVA_OPTS -jar $LOGSTASH_JAR $service $verbose -f "$config" -l "$logfile" 2>&1 >> $logfile &
rs=$?
[ $rs -eq 0 -a "x$pidfile" != "x" ] && printf '%d' $! > "$pidfile"
fi
return $rs
}
service=$1; shift
if [ "${service}" != "agent" -a "${service}" != "web" ]
then
echo "ERROR: no such service \`${service}'. Available services are: agent, web"
usage
exit 99
fi
while test $# -gt 0
do
case "$1" in
-V | --version )
"$JAVA" -jar $LOGSTASH_JAR --version
exit 0
;;
-f | --config )
config="$2"
if [ ! -f "$config" -a ! -d "$config" ]; then
echo "ERROR: config file or directory \`$config' does not exist."
usage
exit 1
fi
shift 2
;;
-P | --pidfile )
pidfile="$2"
shift 2
;;
-l | --logfile )
logfile="$2"
shift 2
;;
-v | --verbose )
if [ "$2" == "debug" ]; then
verbose="-vv"
elif [ "$2" == "info" ]; then
verbose="-v"
fi
shift 2
;;
-h | --help )
usage
exit 0
;;
* )
break
esac
done
if [ "x$config" == "x" ]; then
echo "ERROR: config file is required."
usage
exit 1
fi
run_service "$service" "$config" "$pidfile" "$logfile" "$verbose"
exit $?

View file

@ -1,184 +0,0 @@
%define debug_package %{nil}_bindir}
%define base_install_dir %{_javadir}{%name}
%global bindir %{_bindir}
%global confdir %{_sysconfdir}/%{name}
%global jarpath %{_javadir}
%global lockfile %{_localstatedir}/lock/subsys/%{name}
%global logdir %{_localstatedir}/log/%{name}
%global piddir %{_localstatedir}/run/%{name}
%global sysconfigdir %{_sysconfdir}/sysconfig
Name: logstash
Version: 1.3.2
Release: 1%{?dist}
Summary: A tool for managing events and logs
Group: System Environment/Daemons
License: ASL 2.0
URL: http://logstash.net
Source0: https://logstash.objects.dreamhost.com/release/%{name}-%{version}-flatjar.jar
Source1: logstash.wrapper
Source2: logstash.logrotate
Source3: logstash.init
Source4: logstash.sysconfig
Source5: logstash.conf
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: x86_64 i386 i686 arm
Requires: java
Requires: jpackage-utils
Requires(post): chkconfig initscripts
Requires(pre): chkconfig initscripts
Requires(pre): shadow-utils
%description
A tool for managing events and logs.
%prep
%build
%install
rm -rf $RPM_BUILD_ROOT
# JAR file
%{__mkdir} -p %{buildroot}%{_javadir}
%{__install} -p -m 644 %{SOURCE0} %{buildroot}%{jarpath}/%{name}.jar
# Config
%{__mkdir} -p %{buildroot}%{confdir}
%{__install} -m 644 %{SOURCE5} %{buildroot}%{confdir}/%{name}.conf
# Wrapper script
%{__mkdir} -p %{buildroot}%{_bindir}
%{__install} -m 755 %{SOURCE1} %{buildroot}%{bindir}/%{name}
%{__sed} -i \
-e "s|@@@NAME@@@|%{name}|g" \
-e "s|@@@JARPATH@@@|%{jarpath}|g" \
%{buildroot}%{bindir}/%{name}
# Logs
%{__mkdir} -p %{buildroot}%{logdir}
%{__install} -D -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
# Misc
%{__mkdir} -p %{buildroot}%{piddir}
# sysconfig and init
%{__mkdir} -p %{buildroot}%{_initddir}
%{__mkdir} -p %{buildroot}%{_sysconfdir}/sysconfig
%{__install} -m 755 %{SOURCE3} %{buildroot}%{_initddir}/%{name}
%{__install} -m 644 %{SOURCE4} %{buildroot}%{sysconfigdir}/%{name}
%{__sed} -i \
-e "s|@@@NAME@@@|%{name}|g" \
-e "s|@@@DAEMON@@@|%{bindir}|g" \
-e "s|@@@CONFDIR@@@|%{confdir}|g" \
-e "s|@@@LOCKFILE@@@|%{lockfile}|g" \
-e "s|@@@LOGDIR@@@|%{logdir}|g" \
-e "s|@@@PIDDIR@@@|%{piddir}|g" \
%{buildroot}%{_initddir}/%{name}
%{__sed} -i \
-e "s|@@@NAME@@@|%{name}|g" \
-e "s|@@@CONFDIR@@@|%{confdir}|g" \
-e "s|@@@LOGDIR@@@|%{logdir}|g" \
-e "s|@@@PLUGINDIR@@@|%{_datadir}|g" \
%{buildroot}%{sysconfigdir}/%{name}
%pre
# create logstash group
if ! getent group logstash >/dev/null; then
groupadd -r logstash
fi
# create logstash user
if ! getent passwd logstash >/dev/null; then
useradd -r -g logstash -d %{_javadir}/%{name} \
-s /sbin/nologin -c "You know, for search" logstash
fi
%post
/sbin/chkconfig --add logstash
%preun
if [ $1 -eq 0 ]; then
/sbin/service logstash stop >/dev/null 2>&1
/sbin/chkconfig --del logstash
fi
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
# JAR file
%{_javadir}/%{name}.jar
# Config
%config(noreplace) %{confdir}/
# Wrapper script
%{bindir}/*
# Logrotate
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
# Sysconfig and init
%{_initddir}/%{name}
%config(noreplace) %{sysconfigdir}/*
%defattr(-,%{name},%{name},-)
%dir %{logdir}/
%dir %{piddir}/
%changelog
* Sat Jan 4 2014 <sbagmeijer@ulyaoth.asia> - 1.3.2-1
- Updated version to 1.3.2
- Added BuildArch for arm fedora
* Sun Oct 27 2013 <sbagmeijer@ulyaoth.asia> - 1.2.2-2
- Fixed the bogus date warning
* Wed Oct 23 2013 <sjir@basefarm.no> - 1.2.2-1
- Update logstash version to 1.2.2-1
* Fri Sep 27 2013 <sbagmeijer@ulyaoth.asia> - 1.2.1-1
- Building for Fedora 18, 19 and 20-alpha.
- Added Source5 for logstash.conf
- Fixed the BuildArch so it can be build for i386
* Mon Sep 16 2013 <sjir@basefarm.se> - 1.2.1
- Updated version to the new 1.2.1
- Removed everything related to plugins as it no longer works.
* Wed Sep 04 2013 <sjir@basefarm.se> - 1.2.0
- Updated version to the new 1.2.0.
- Fixed a problem with the init.d script not working correctly.
* Fri Jun 14 2013 <sjir@basefarm.se> - 1.1.13-1
- Updated version to the new 1.1.13-1 and fixed some minor issues with directory structure.
* Mon May 6 2013 <sjir@basefarm.se> - 1.1.10-3
- Changed from logstash flatjar to the monolith as flatjar is not working correctly yet.
* Fri Apr 19 2013 <sjir@basefarm.se> - 1.1.10-2
- Fixed a bug
* Fri Apr 19 2013 <sjir@basefarm.se> - 1.1.10-1
- Added fixes to support RHEL6
- Update logstash version to 1.1.10
* Sun Mar 17 2013 Richard Pijnenburg <richard@ispavailability.com> - 1.1.9-2
- Update init script
- Create patterns dir in correct place
* Fri Feb 1 2013 Richard Pijnenburg <richard@ispavailability.com> - 1.1.9-1
- Update to latest stable release.
- New init script
* Fri May 4 2012 Maksim Horbul <max@gorbul.net> - 1.1.0-1
- Initial package

View file

@ -1,4 +0,0 @@
# RPM build
spectool -g SPECS/logstash.spec
rpmbuild -bb SPECS/logstash.spec

View file

@ -3,5 +3,3 @@
chown -R logstash:logstash /opt/logstash
chown logstash /var/log/logstash
chown logstash:logstash /var/lib/logstash
ln -sf /opt/logstash/logstash.jar /var/lib/logstash/logstash.jar

View file

@ -1,7 +1,7 @@
#!/bin/sh
if [ $1 == "remove" ]; then
stop logstash >/dev/null 2>&1 || true
if [ $1 = "remove" ]; then
service logstash stop >/dev/null 2>&1 || true
if getent passwd logstash >/dev/null ; then
userdel logstash