Gentoo Archives: gentoo-commits

From: Patrick Lauer <patrick@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-admin/logstash-bin/, app-admin/logstash-bin/files/
Date: Fri, 01 Apr 2016 09:15:54
Message-Id: 1459502142.aebd48ccc5b5eef3ddc478125384f16863b7baf3.patrick@gentoo
1 commit: aebd48ccc5b5eef3ddc478125384f16863b7baf3
2 Author: Patrick Lauer <patrick <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 1 09:08:34 2016 +0000
4 Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 1 09:15:42 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aebd48cc
7
8 app-admin/logstash-bin: Update init script and logrotate config
9
10 Package-Manager: portage-2.2.28
11
12 app-admin/logstash-bin/files/logstash.confd-r1 | 37 +++++++++++++
13 app-admin/logstash-bin/files/logstash.initd-r1 | 57 ++++++++++++++++++++
14 app-admin/logstash-bin/files/logstash.logrotate-r1 | 6 +++
15 .../logstash-bin/logstash-bin-2.2.2-r1.ebuild | 60 ++++++++++++++++++++++
16 4 files changed, 160 insertions(+)
17
18 diff --git a/app-admin/logstash-bin/files/logstash.confd-r1 b/app-admin/logstash-bin/files/logstash.confd-r1
19 new file mode 100644
20 index 0000000..6d197a2
21 --- /dev/null
22 +++ b/app-admin/logstash-bin/files/logstash.confd-r1
23 @@ -0,0 +1,37 @@
24 +###############################
25 +# Default settings for logstash
26 +###############################
27 +
28 +# Set a home directory
29 +#LS_HOME=/var/lib/logstash
30 +
31 +# Arguments to pass to logstash agent
32 +#LS_OPTS=""
33 +
34 +# Arguments to pass to java
35 +#LS_HEAP_SIZE="500m"
36 +#LS_JAVA_OPTS="-Djava.io.tmpdir=$HOME"
37 +
38 +# pidfiles location
39 +#LS_PIDFILE=/run/logstash/logstash.pid
40 +
41 +# user id to be invoked as
42 +#LS_USER=logstash
43 +#LS_GROUP=logstash
44 +
45 +# logstash logging
46 +#LS_LOG_FILE=/var/log/logstash/logstash.log
47 +#LS_USE_GC_LOGGING="true"
48 +
49 +# logstash configuration directory
50 +#LS_CONF_DIR=/etc/logstash/conf.d
51 +
52 +# Open file limit
53 +#LS_OPEN_FILES=16384
54 +
55 +# Nice level
56 +#LS_NICE=19
57 +
58 +# If this is set to 1, then when `stop` is called, if the process has
59 +# not exited within a reasonable time, SIGKILL will be sent next.
60 +KILL_ON_STOP_TIMEOUT=0
61
62 diff --git a/app-admin/logstash-bin/files/logstash.initd-r1 b/app-admin/logstash-bin/files/logstash.initd-r1
63 new file mode 100644
64 index 0000000..91f6297
65 --- /dev/null
66 +++ b/app-admin/logstash-bin/files/logstash.initd-r1
67 @@ -0,0 +1,57 @@
68 +#!/sbin/openrc-run
69 +# Copyright 1999-2015 Gentoo Foundation
70 +# Distributed under the terms of the GNU General Public License v2
71 +
72 +LS_USER=${LS_USER:-logstash}
73 +LS_GROUP=${LS_GROUP:-$LS_USER}
74 +LS_LOG_FILE=${LS_LOG_FILE:-/var/log/logstash/logstash.log}
75 +LS_CONF_DIR=${LS_CONF_DIR:-/etc/logstash/conf.d}
76 +LS_HOME=${LS_HOME:-/var/lib/logstash}
77 +LS_HEAP_SIZE=${LS_HEAP_SIZE:-500m}
78 +LS_NICE=${LS_NICE:-19}
79 +LS_JAVA_OPTS=${LS_JAVA_OPTS:-"-Djava.io.tmpdir=${LS_HOME}"}
80 +LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING:-false}
81 +LS_OPEN_FILES=${LS_OPEN_FILES:-16384}
82 +KILL_ON_STOP_TIMEOUT=${KILL_ON_STOP_TIMEOUT:-0}
83 +
84 +command="/opt/logstash/bin/logstash"
85 +command_args="agent --config ${LS_CONF_DIR} --log ${LS_LOG_FILE} ${LS_OPTS}"
86 +command_background="true"
87 +pidfile=${LS_PIDFILE:-"/run/logstash/logstash.pid"}
88 +
89 +start_stop_daemon_args="--user ${LS_USER}:${LS_GROUP} \
90 + --chdir ${LS_HOME}
91 + --nicelevel ${LS_NICE}
92 + --env LS_HEAP_SIZE=${LS_HEAP_SIZE}
93 + --env LS_JAVA_OPTS=${LS_JAVA_OPTS}
94 + --env LS_USE_GC_LOGGING=${LS_USE_GC_LOGGING}"
95 +
96 +extra_commands="checkconfig"
97 +
98 +checkconfig() {
99 + ebegin "Checking your configuration"
100 + ${command} ${command_args} --configtest
101 + eend $? "Configuration error. Please fix your configuration files."
102 +}
103 +
104 +start_pre() {
105 + checkconfig || return 1
106 +
107 + rc_ulimit="-n ${LS_OPEN_FILES}"
108 +
109 + checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname "${pidfile}")"
110 + checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$(dirname "${LS_LOG_FILE}")"
111 + checkpath -f -o "${LS_USER}":"${LS_GROUP}" -m640 "${LS_LOG_FILE}"
112 +}
113 +
114 +stop() {
115 + ebegin "Stopping logstash"
116 + if [ "${KILL_ON_STOP_TIMEOUT}" == "1" ]; then
117 + start-stop-daemon --stop \
118 + --pidfile=${pidfile} \
119 + --retry=TERM/5/KILL/5
120 + else
121 + start-stop-daemon --stop \
122 + --pidfile=${pidfile}
123 + fi
124 +}
125
126 diff --git a/app-admin/logstash-bin/files/logstash.logrotate-r1 b/app-admin/logstash-bin/files/logstash.logrotate-r1
127 new file mode 100644
128 index 0000000..5de699a
129 --- /dev/null
130 +++ b/app-admin/logstash-bin/files/logstash.logrotate-r1
131 @@ -0,0 +1,6 @@
132 +/var/log/logstash/*.{err,log} {
133 + copytruncate
134 + compress
135 + missingok
136 + notifempty
137 +}
138
139 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
140 new file mode 100644
141 index 0000000..8d3ffea
142 --- /dev/null
143 +++ b/app-admin/logstash-bin/logstash-bin-2.2.2-r1.ebuild
144 @@ -0,0 +1,60 @@
145 +# Copyright 1999-2015 Gentoo Foundation
146 +# Distributed under the terms of the GNU General Public License v2
147 +# $Id$
148 +
149 +EAPI=5
150 +
151 +inherit user
152 +
153 +MY_PN="${PN/-bin}"
154 +MY_P="${MY_PN}-${PV}"
155 +
156 +DESCRIPTION="Tool for managing events and logs"
157 +HOMEPAGE="https://www.elastic.co/products/logstash"
158 +SRC_URI="https://download.elastic.co/${MY_PN}/${MY_PN}/${MY_P}.tar.gz"
159 +
160 +LICENSE="Apache-2.0"
161 +SLOT="0"
162 +KEYWORDS="~amd64"
163 +IUSE=""
164 +
165 +RESTRICT="strip"
166 +QA_PREBUILT="opt/logstash/vendor/jruby/lib/jni/*/libjffi*.so"
167 +
168 +DEPEND=""
169 +RDEPEND="|| ( virtual/jre:1.8 virtual/jre:1.7 )"
170 +
171 +S="${WORKDIR}/${MY_P}"
172 +
173 +pkg_setup() {
174 + enewgroup ${MY_PN}
175 + enewuser ${MY_PN} -1 -1 /var/lib/${MY_PN} ${MY_PN} -m
176 +}
177 +
178 +src_install() {
179 + keepdir /etc/"${MY_PN}"/{conf.d,patterns,plugins}
180 + keepdir "/var/log/${MY_PN}"
181 +
182 + insinto "/etc/${MY_PN}/conf.d"
183 + doins "${FILESDIR}/agent.conf.sample"
184 +
185 + insinto "/opt/${MY_PN}"
186 + doins -r .
187 + fperms 0755 "/opt/${MY_PN}/bin/${MY_PN}" "/opt/${MY_PN}/vendor/jruby/bin/jruby"
188 +
189 + insinto /etc/logrotate.d
190 + newins "${FILESDIR}/${MY_PN}.logrotate-r1" "${MY_PN}"
191 +
192 + newconfd "${FILESDIR}/${MY_PN}.confd-r1" "${MY_PN}"
193 + newinitd "${FILESDIR}/${MY_PN}.initd-r1" "${MY_PN}"
194 +}
195 +
196 +pkg_postinst() {
197 + einfo "Getting started with logstash:"
198 + einfo " https://www.elastic.co/guide/en/logstash/current/getting-started-with-logstash.html"
199 + einfo ""
200 + einfo "Packages that might be interesting:"
201 + einfo " app-misc/elasticsearch"
202 + einfo " dev-python/elasticsearch-curator"
203 + einfo " www-apps/kibana-bin"
204 +}