commit:     aebd48ccc5b5eef3ddc478125384f16863b7baf3
Author:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
AuthorDate: Fri Apr  1 09:08:34 2016 +0000
Commit:     Patrick Lauer <patrick <AT> gentoo <DOT> org>
CommitDate: Fri Apr  1 09:15:42 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aebd48cc

app-admin/logstash-bin: Update init script and logrotate config

Package-Manager: portage-2.2.28

 app-admin/logstash-bin/files/logstash.confd-r1     | 37 +++++++++++++
 app-admin/logstash-bin/files/logstash.initd-r1     | 57 ++++++++++++++++++++
 app-admin/logstash-bin/files/logstash.logrotate-r1 |  6 +++
 .../logstash-bin/logstash-bin-2.2.2-r1.ebuild      | 60 ++++++++++++++++++++++
 4 files changed, 160 insertions(+)

diff --git a/app-admin/logstash-bin/files/logstash.confd-r1 
b/app-admin/logstash-bin/files/logstash.confd-r1
new file mode 100644
index 0000000..6d197a2
--- /dev/null
+++ b/app-admin/logstash-bin/files/logstash.confd-r1
@@ -0,0 +1,37 @@
+###############################
+# Default settings for logstash
+###############################
+
+# Set a home directory
+#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 location
+#LS_PIDFILE=/run/logstash/logstash.pid
+
+# user id to be invoked as
+#LS_USER=logstash
+#LS_GROUP=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
+#LS_OPEN_FILES=16384
+
+# Nice level
+#LS_NICE=19
+
+# If this is set to 1, then when `stop` is called, if the process has
+# not exited within a reasonable time, SIGKILL will be sent next.
+KILL_ON_STOP_TIMEOUT=0

diff --git a/app-admin/logstash-bin/files/logstash.initd-r1 
b/app-admin/logstash-bin/files/logstash.initd-r1
new file mode 100644
index 0000000..91f6297
--- /dev/null
+++ b/app-admin/logstash-bin/files/logstash.initd-r1
@@ -0,0 +1,57 @@
+#!/sbin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+LS_USER=${LS_USER:-logstash}
+LS_GROUP=${LS_GROUP:-$LS_USER}
+LS_LOG_FILE=${LS_LOG_FILE:-/var/log/logstash/logstash.log}
+LS_CONF_DIR=${LS_CONF_DIR:-/etc/logstash/conf.d}
+LS_HOME=${LS_HOME:-/var/lib/logstash}
+LS_HEAP_SIZE=${LS_HEAP_SIZE:-500m}
+LS_NICE=${LS_NICE:-19}
+LS_JAVA_OPTS=${LS_JAVA_OPTS:-"-Djava.io.tmpdir=${LS_HOME}"}
+LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING:-false}
+LS_OPEN_FILES=${LS_OPEN_FILES:-16384}
+KILL_ON_STOP_TIMEOUT=${KILL_ON_STOP_TIMEOUT:-0}
+
+command="/opt/logstash/bin/logstash"
+command_args="agent --config ${LS_CONF_DIR} --log ${LS_LOG_FILE} ${LS_OPTS}"
+command_background="true"
+pidfile=${LS_PIDFILE:-"/run/logstash/logstash.pid"}
+
+start_stop_daemon_args="--user ${LS_USER}:${LS_GROUP} \
+       --chdir ${LS_HOME}
+       --nicelevel ${LS_NICE}
+       --env LS_HEAP_SIZE=${LS_HEAP_SIZE}
+       --env LS_JAVA_OPTS=${LS_JAVA_OPTS}
+       --env LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING}"
+
+extra_commands="checkconfig"
+
+checkconfig() {
+       ebegin "Checking your configuration"
+       ${command} ${command_args} --configtest
+       eend $? "Configuration error. Please fix your configuration files."
+}
+
+start_pre() {
+       checkconfig || return 1
+
+       rc_ulimit="-n ${LS_OPEN_FILES}"
+
+       checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname 
"${pidfile}")"
+       checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname 
"${LS_LOG_FILE}")"
+       checkpath -f -o "${LS_USER}":"${LS_GROUP}" -m640 "${LS_LOG_FILE}"
+}
+
+stop() {
+       ebegin "Stopping logstash"
+       if [ "${KILL_ON_STOP_TIMEOUT}" == "1" ]; then
+               start-stop-daemon --stop \
+                       --pidfile=${pidfile} \
+                       --retry=TERM/5/KILL/5
+       else
+               start-stop-daemon --stop \
+                       --pidfile=${pidfile}
+       fi
+}

diff --git a/app-admin/logstash-bin/files/logstash.logrotate-r1 
b/app-admin/logstash-bin/files/logstash.logrotate-r1
new file mode 100644
index 0000000..5de699a
--- /dev/null
+++ b/app-admin/logstash-bin/files/logstash.logrotate-r1
@@ -0,0 +1,6 @@
+/var/log/logstash/*.{err,log} {
+        copytruncate
+        compress
+        missingok
+        notifempty
+}

diff --git a/app-admin/logstash-bin/logstash-bin-2.2.2-r1.ebuild 
b/app-admin/logstash-bin/logstash-bin-2.2.2-r1.ebuild
new file mode 100644
index 0000000..8d3ffea
--- /dev/null
+++ b/app-admin/logstash-bin/logstash-bin-2.2.2-r1.ebuild
@@ -0,0 +1,60 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit user
+
+MY_PN="${PN/-bin}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Tool for managing events and logs"
+HOMEPAGE="https://www.elastic.co/products/logstash";
+SRC_URI="https://download.elastic.co/${MY_PN}/${MY_PN}/${MY_P}.tar.gz";
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE=""
+
+RESTRICT="strip"
+QA_PREBUILT="opt/logstash/vendor/jruby/lib/jni/*/libjffi*.so"
+
+DEPEND=""
+RDEPEND="|| ( virtual/jre:1.8 virtual/jre:1.7 )"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+       enewgroup ${MY_PN}
+       enewuser ${MY_PN} -1 -1 /var/lib/${MY_PN} ${MY_PN} -m
+}
+
+src_install() {
+       keepdir /etc/"${MY_PN}"/{conf.d,patterns,plugins}
+       keepdir "/var/log/${MY_PN}"
+
+       insinto "/etc/${MY_PN}/conf.d"
+       doins "${FILESDIR}/agent.conf.sample"
+
+       insinto "/opt/${MY_PN}"
+       doins -r .
+       fperms 0755 "/opt/${MY_PN}/bin/${MY_PN}" 
"/opt/${MY_PN}/vendor/jruby/bin/jruby"
+
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}/${MY_PN}.logrotate-r1" "${MY_PN}"
+
+       newconfd "${FILESDIR}/${MY_PN}.confd-r1" "${MY_PN}"
+       newinitd "${FILESDIR}/${MY_PN}.initd-r1" "${MY_PN}"
+}
+
+pkg_postinst() {
+       einfo "Getting started with logstash:"
+       einfo "  
https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html";
+       einfo ""
+       einfo "Packages that might be interesting:"
+       einfo "  app-misc/elasticsearch"
+       einfo "  dev-python/elasticsearch-curator"
+       einfo "  www-apps/kibana-bin"
+}

Reply via email to