diff options
Diffstat (limited to 'app-admin/logstash-forwarder')
5 files changed, 127 insertions, 0 deletions
diff --git a/app-admin/logstash-forwarder/Manifest b/app-admin/logstash-forwarder/Manifest new file mode 100644 index 00000000000..9816a7a2ba9 --- /dev/null +++ b/app-admin/logstash-forwarder/Manifest @@ -0,0 +1 @@ +DIST logstash-forwarder-0.4.0.tar.gz 35189 SHA256 d930cd33747b2826c7358238a25e690324751d1b098e7c00de1357944766b3c3 SHA512 1f89b065d1b26a6f5b18da6215bdaed5a312af12fa721835f5e1a77248dd67f398f5af08b5d93c0c4c5ef9623eb1ddb58449b52039c0db0241d5ca61872102ef WHIRLPOOL 7715c723f8b8712b5cccc1e678017b2d733f243ea936d312ab31938fba73934a66d552656516bc72b65a3541945401f99463d8346fdf6a00372e9b3a0ed67655 diff --git a/app-admin/logstash-forwarder/files/logstash-forwarder.confd b/app-admin/logstash-forwarder/files/logstash-forwarder.confd new file mode 100644 index 00000000000..e49ed1dc295 --- /dev/null +++ b/app-admin/logstash-forwarder/files/logstash-forwarder.confd @@ -0,0 +1 @@ +LOGSTASH_FORWARDER_ARGS="-quiet -syslog=true" diff --git a/app-admin/logstash-forwarder/files/logstash-forwarder.initd b/app-admin/logstash-forwarder/files/logstash-forwarder.initd new file mode 100644 index 00000000000..38e09b65ab6 --- /dev/null +++ b/app-admin/logstash-forwarder/files/logstash-forwarder.initd @@ -0,0 +1,63 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +create_tmpdir() { + local tmpdir="$(mktemp -d -p /tmp logstash-forwarder.XXXXXXXXXX)" + + chown logstash:logstash "${tmpdir}" || return 1 + chmod 0750 "${tmpdir}" || return 1 + + echo "${tmpdir}" +} + +remove_tmpdir() { + local d='' + local tmpdir='' + + for d in /tmp/logstash-forwarder.??????????; do + [[ -e ${d} ]] || return 0 + [[ -d ${d} ]] || continue + + if ! [[ ${tmpdir} ]]; then + tmpdir="${d}" + else + # There are more directories like that, so better keep them all. + return 1 + fi + done + + rm -r "${tmpdir}" +} + +start() { + local config_file=/etc/logstash-forwarder/logstash-forwarder.conf + local tmpdir="$(create_tmpdir)" + + if ! [[ -d ${tmpdir} ]]; then + eend 1 "Failed to create tmp directory for logstash-forwarder" + return 1 + fi + + ebegin "Starting logstash-forwarder" + start-stop-daemon --start --exec /usr/bin/logstash-forwarder \ + --make-pidfile --pidfile /run/logstash-forwarder.pid \ + --background --wait 100 --chdir "${tmpdir}" \ + --user logstash --group logstash \ + -- -config="${config_file}" ${LOGSTASH_FORWARDER_ARGS} + eend $? +} + +stop() { + ebegin "Stopping logstash-forwarder" + start-stop-daemon --stop --exec /usr/bin/logstash-forwarder \ + --pidfile /run/logstash-forwarder.pid --user logstash --group logstash + local rc=$? + + if ! remove_tmpdir; then + ewarn "Failed to remove logstash-forwarder tmp directory" + fi + + eend ${rc} +} diff --git a/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild b/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild new file mode 100644 index 00000000000..ddca446b103 --- /dev/null +++ b/app-admin/logstash-forwarder/logstash-forwarder-0.4.0.ebuild @@ -0,0 +1,44 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +inherit user + +DESCRIPTION="Collects logs locally in preparation for processing elsewhere" +HOMEPAGE="https://github.com/elastic/logstash-forwarder" +SRC_URI="https://github.com/elastic/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="dev-lang/go:=" +RDEPEND="" + +pkg_setup() { + enewgroup logstash + enewuser logstash -1 -1 -1 logstash +} + +src_install() { + dobin "${PN}" + dodir "/etc/${PN}" + dodoc "${PN}".conf.example CHANGELOG README.md + newconfd "${FILESDIR}/${PN}.confd" "${PN}" + newinitd "${FILESDIR}/${PN}.initd" "${PN}" +} + +pkg_postinst() { + if ! [[ -e /etc/${PN}/${PN}.conf ]]; then + elog "Before starting logstash-forwarder create config file at" + elog + elog " /etc/${PN}/${PN}.conf" + elog + elog "See example in /usr/share/doc/${PVR} directory. You can remove" + elog "-quiet from logstash-forward arguments in /etc/conf.d/${PN} to" + elog "until you get working configuration. Search syslog for errors." + fi +} diff --git a/app-admin/logstash-forwarder/metadata.xml b/app-admin/logstash-forwarder/metadata.xml new file mode 100644 index 00000000000..8686ab814fd --- /dev/null +++ b/app-admin/logstash-forwarder/metadata.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer> + <email>aidecoe@gentoo.org</email> + <name>Amadeusz Żołnowski</name> + </maintainer> + <longdescription lang="en"> + logstash-forwarder is a lightweight replacement for logstash when you + only need to collect logs locally in preparation for processing + elsewhere. It is written in Go and uses not much memory. For + transmission lumberjack protocol is used. It is is secure, low + latency, low resource usage, and reliable. + </longdescription> + <upstream> + <remote-id type="github">elastic/logstash-forwarder</remote-id> + </upstream> +</pkgmetadata> |