From c846729fc6ea0db39ec9ea2496cc55a00bbcfdd7 Mon Sep 17 00:00:00 2001 From: Tomas Mozes Date: Mon, 7 Dec 2015 13:29:57 +0100 Subject: app-admin/filebeat-bin: new ebuild --- app-admin/filebeat-bin/Manifest | 2 + app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild | 53 +++++++++++++++++++++++ app-admin/filebeat-bin/files/filebeat.confd | 5 +++ app-admin/filebeat-bin/files/filebeat.initd | 47 ++++++++++++++++++++ app-admin/filebeat-bin/files/filebeat.yml.example | 14 ++++++ app-admin/filebeat-bin/metadata.xml | 10 +++++ 6 files changed, 131 insertions(+) create mode 100644 app-admin/filebeat-bin/Manifest create mode 100644 app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild create mode 100644 app-admin/filebeat-bin/files/filebeat.confd create mode 100644 app-admin/filebeat-bin/files/filebeat.initd create mode 100644 app-admin/filebeat-bin/files/filebeat.yml.example create mode 100644 app-admin/filebeat-bin/metadata.xml (limited to 'app-admin') diff --git a/app-admin/filebeat-bin/Manifest b/app-admin/filebeat-bin/Manifest new file mode 100644 index 000000000000..430abbc6f618 --- /dev/null +++ b/app-admin/filebeat-bin/Manifest @@ -0,0 +1,2 @@ +DIST filebeat-1.0.0-i686.tar.gz 3069805 SHA256 f184fe7d5cd566bdf1a48f79cd52c0d3ef960782b2076e8df67836e0ed36dc37 SHA512 c4df33524249aef574f923c67be56e22f8eb24a51933178a90b080cc59aec772052c653bf551f198c08e63c7cb03fa9f346dc7c5cee31c586270c532655486df WHIRLPOOL e2be905de1aa0749bfb419bff50fc1952dc7dc5b2d127045709f08e6e6cb38faae1372d64515c4157949138cdbd10888aea0e0fe4e98f57d69a73873eb578483 +DIST filebeat-1.0.0-x86_64.tar.gz 3260387 SHA256 f0bcc2dc9ae720a672fe5f4b22c0d132f7131d4d07484f4100453c7122f0561a SHA512 823450554ec6d7ae43ff064e967ad8d5bef95077404738feac7f7ae5ef74000e051042ea3734423b883bab9102d90a4e707d9c0d03c88abe2f34862f02d01ed4 WHIRLPOOL 5a6b9b532d090a87724f17af3727cca772f48602c39cb9d82593f3c4f4ab722f295db647ba4d0152bf3baa41134b5561c2e9655a02d47c25e228af64122e3609 diff --git a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild new file mode 100644 index 000000000000..9d5192573345 --- /dev/null +++ b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild @@ -0,0 +1,53 @@ +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +EAPI=5 + +MY_PN=${PN/-bin/} +MY_P=${MY_PN}-${PV} + +DESCRIPTION="Lightweight log shipper for Logstash and Elasticsearch" +HOMEPAGE="https://www.elastic.co/products/beats" +SRC_URI="amd64? ( https://download.elastic.co/beats/${MY_PN}/${MY_P}-x86_64.tar.gz ) + x86? ( https://download.elastic.co/beats/${MY_PN}/${MY_P}-i686.tar.gz )" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +DEPEND="" +RDEPEND="${DEPEND}" + +src_unpack() { + if use amd64; then + S="${WORKDIR}/${MY_P}-x86_64" + elif use x86; then + S="${WORKDIR}/${MY_P}-i686" + fi + + default +} + +src_install() { + keepdir /etc/${MY_PN} + keepdir /var/lib/${MY_PN} + + fperms 0750 /var/lib/${MY_PN} + + insinto /etc/${MY_PN} + doins "${FILESDIR}/filebeat.yml.example" + + newconfd "${FILESDIR}/${MY_PN}.confd" ${MY_PN} + newinitd "${FILESDIR}/${MY_PN}.initd" ${MY_PN} + + dobin ${MY_PN} +} + +pkg_postinst() { + if [[ ! -e /etc/${MY_PN}/${MY_PN}.yml ]]; then + elog "Before starting filebeat, you need to create a configuration file at:" + elog "/etc/${MY_PN}/${MY_PN}.yml" + fi +} diff --git a/app-admin/filebeat-bin/files/filebeat.confd b/app-admin/filebeat-bin/files/filebeat.confd new file mode 100644 index 000000000000..188f447f265b --- /dev/null +++ b/app-admin/filebeat-bin/files/filebeat.confd @@ -0,0 +1,5 @@ +#FILEBEAT_USER="" +#FILEBEAT_GROUP="" +#FILEBEAT_CONFIG="" +#FILEBEAT_STATEDIR="" +#FILEBEAT_OPTS="" diff --git a/app-admin/filebeat-bin/files/filebeat.initd b/app-admin/filebeat-bin/files/filebeat.initd new file mode 100644 index 000000000000..3ffc340bb54d --- /dev/null +++ b/app-admin/filebeat-bin/files/filebeat.initd @@ -0,0 +1,47 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +FILEBEAT_USER="${FILEBEAT_USER:-root}" +FILEBEAT_GROUP="${FILEBEAT_GROUP:-root}" +FILEBEAT_CONFIG="${FILEBEAT_CONFIG:-/etc/filebeat/filebeat.yml}" +FILEBEAT_STATEDIR="${FILEBEAT_STATEDIR:-/var/lib/filebeat}" +FILEBEAT_OPTS="${FILEBEAT_OPTS:-}" + +command="/usr/bin/filebeat" +command_args="${FILEBEAT_OPTS}" +extra_commands="checkconfig" +command_background="true" +start_stop_daemon_args="--user ${FILEBEAT_USER}:${FILEBEAT_GROUP} \ + --chdir ${FILEBEAT_STATEDIR}" +pidfile="/run/filebeat/filebeat.pid" + +depend() { + use net + after elasticsearch +} + +checkconfig() { + if [ ! -e ${FILEBEAT_CONFIG} ]; then + eend "Please create a configuration file at ${FILEBEAT_CONFIG}" + return 1 + fi + + ebegin "Checking your configuration" + ${command} ${command_args} -configtest + eend $? "Configuration error. Please fix your configuration files." +} + +start_pre() { + checkconfig || return 1 + + checkpath -d -o "${FILEBEAT_USER}":"${FILEBEAT_GROUP}" -m750 "$(dirname "${pidfile}")" + checkpath -d -o "${FILEBEAT_USER}":"${FILEBEAT_GROUP}" -m750 "${FILEBEAT_STATEDIR}" +} + +stop() { + ebegin "Stopping filebeat" + start-stop-daemon --stop \ + --pidfile=${pidfile} \ + --retry=TERM/5/KILL/5 +} diff --git a/app-admin/filebeat-bin/files/filebeat.yml.example b/app-admin/filebeat-bin/files/filebeat.yml.example new file mode 100644 index 000000000000..06c599cc6f37 --- /dev/null +++ b/app-admin/filebeat-bin/files/filebeat.yml.example @@ -0,0 +1,14 @@ +filebeat: + prospectors: + - + paths: + - /var/log/*.log + - /var/log/debug + - /var/log/messages + - /var/log/syslog + input_type: log + +output: + elasticsearch: + hosts: ["localhost:9200"] + index: "logstash" diff --git a/app-admin/filebeat-bin/metadata.xml b/app-admin/filebeat-bin/metadata.xml new file mode 100644 index 000000000000..fe6f9ccf1a7e --- /dev/null +++ b/app-admin/filebeat-bin/metadata.xml @@ -0,0 +1,10 @@ + + + + proxy-maintainers + + hydrapolic@gmail.com + Tomas Mozes + Proxy maintainer + + -- cgit v1.2.3 From bae0c59491f65eb518201b3ddec7a88d179cc830 Mon Sep 17 00:00:00 2001 From: Tomas Mozes Date: Mon, 7 Dec 2015 15:27:07 +0100 Subject: app-admin/filebeat-bin: use bundled example config --- app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild | 6 +++--- app-admin/filebeat-bin/files/filebeat.yml.example | 14 -------------- 2 files changed, 3 insertions(+), 17 deletions(-) delete mode 100644 app-admin/filebeat-bin/files/filebeat.yml.example (limited to 'app-admin') diff --git a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild index 9d5192573345..a6d18e4ed2ce 100644 --- a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild +++ b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild @@ -36,12 +36,12 @@ src_install() { fperms 0750 /var/lib/${MY_PN} - insinto /etc/${MY_PN} - doins "${FILESDIR}/filebeat.yml.example" - newconfd "${FILESDIR}/${MY_PN}.confd" ${MY_PN} newinitd "${FILESDIR}/${MY_PN}.initd" ${MY_PN} + insinto /etc/${MY_PN} + newins ${MY_PN}.yml ${MY_PN}.yml.example + dobin ${MY_PN} } diff --git a/app-admin/filebeat-bin/files/filebeat.yml.example b/app-admin/filebeat-bin/files/filebeat.yml.example deleted file mode 100644 index 06c599cc6f37..000000000000 --- a/app-admin/filebeat-bin/files/filebeat.yml.example +++ /dev/null @@ -1,14 +0,0 @@ -filebeat: - prospectors: - - - paths: - - /var/log/*.log - - /var/log/debug - - /var/log/messages - - /var/log/syslog - input_type: log - -output: - elasticsearch: - hosts: ["localhost:9200"] - index: "logstash" -- cgit v1.2.3 From 4df487160fa12a034308394b6cd996f1dbc53383 Mon Sep 17 00:00:00 2001 From: Tomas Mozes Date: Mon, 7 Dec 2015 15:28:18 +0100 Subject: app-admin/filebeat-bin: specify configuration file --- app-admin/filebeat-bin/files/filebeat.initd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app-admin') diff --git a/app-admin/filebeat-bin/files/filebeat.initd b/app-admin/filebeat-bin/files/filebeat.initd index 3ffc340bb54d..6de6d2780691 100644 --- a/app-admin/filebeat-bin/files/filebeat.initd +++ b/app-admin/filebeat-bin/files/filebeat.initd @@ -9,7 +9,7 @@ FILEBEAT_STATEDIR="${FILEBEAT_STATEDIR:-/var/lib/filebeat}" FILEBEAT_OPTS="${FILEBEAT_OPTS:-}" command="/usr/bin/filebeat" -command_args="${FILEBEAT_OPTS}" +command_args="-c ${FILEBEAT_CONFIG} ${FILEBEAT_OPTS}" extra_commands="checkconfig" command_background="true" start_stop_daemon_args="--user ${FILEBEAT_USER}:${FILEBEAT_GROUP} \ -- cgit v1.2.3 From 76c0804f57e4e92e6a8a94348f5f194d6c8c1c89 Mon Sep 17 00:00:00 2001 From: Tomas Mozes Date: Wed, 9 Dec 2015 08:46:00 +0100 Subject: app-admin/filebeat-bin: removing empty IUSE and (R)DEPEND as suggested by idella --- app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild | 4 ---- 1 file changed, 4 deletions(-) (limited to 'app-admin') diff --git a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild index a6d18e4ed2ce..96d830c7b279 100644 --- a/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild +++ b/app-admin/filebeat-bin/filebeat-bin-1.0.0.ebuild @@ -15,10 +15,6 @@ SRC_URI="amd64? ( https://download.elastic.co/beats/${MY_PN}/${MY_P}-x86_64.tar. LICENSE="Apache-2.0" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="" - -DEPEND="" -RDEPEND="${DEPEND}" src_unpack() { if use amd64; then -- cgit v1.2.3