diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /app-admin/logstash-bin/files |
reinit the tree, so we can have metadata
Diffstat (limited to 'app-admin/logstash-bin/files')
-rw-r--r-- | app-admin/logstash-bin/files/agent.conf.sample | 29 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash-plugin.eselect | 85 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash.confd | 37 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash.confd-r1 | 40 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash.initd | 74 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash.initd-r1 | 75 | ||||
-rw-r--r-- | app-admin/logstash-bin/files/logstash.logrotate | 6 |
7 files changed, 346 insertions, 0 deletions
diff --git a/app-admin/logstash-bin/files/agent.conf.sample b/app-admin/logstash-bin/files/agent.conf.sample new file mode 100644 index 000000000000..85c9b5c93d2a --- /dev/null +++ b/app-admin/logstash-bin/files/agent.conf.sample @@ -0,0 +1,29 @@ +input { + beats { + port => 5044 + } + + # may need root privileges + file { + type => "syslog" + path => [ "/var/log/*.log", "/var/log/debug", "/var/log/messages", "/var/log/syslog" ] + } + + redis { + key => logstash + data_type => list + } + + stdin { + type => "stdin" + } +} + +output { + stdout { + codec => rubydebug + } + + elasticsearch { + } +} diff --git a/app-admin/logstash-bin/files/logstash-plugin.eselect b/app-admin/logstash-bin/files/logstash-plugin.eselect new file mode 100644 index 000000000000..29678309f411 --- /dev/null +++ b/app-admin/logstash-bin/files/logstash-plugin.eselect @@ -0,0 +1,85 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2005-2017 Gentoo Foundation +# Distributed under the terms of the GNU GPL version 2 or later + +DESCRIPTION="Manage user installed plugins of logstash" +MAINTAINER="hydrapolic@gmail.com" + +PLUGINS="/var/lib/logstash/plugins-list.txt" +LS_INSTALL_DIR="/opt/logstash" + +ls_plugin_wrapper() { + JARS_SKIP=true "${LS_INSTALL_DIR}/bin/logstash-plugin" "${1}" "${2}" || die +} + +### install action +describe_install() { + echo "Install plugin" +} + +describe_install_parameters() { + echo "<plugin>" +} + +do_install() { + [[ ${#} -lt 1 ]] && die "Please specify at least one plugin" + + local plugin + for plugin; do + ls_plugin_wrapper install "${plugin}" + echo "${plugin}" >> "${PLUGINS}" || die + done + + sort -u "${PLUGINS}" > "${PLUGINS}.tmp" || die + mv "${PLUGINS}.tmp" "${PLUGINS}" || die +} + +### list action +describe_list() { + echo "List user installed plugins" +} + +do_list() { + if [[ -f "${PLUGINS}" ]]; then + write_list_start "Installed plugins:" + + local plugin + while read -r plugin; do + write_kv_list_entry "${plugin}" + done < "${PLUGINS}" + fi +} + +### reinstall action +describe_reinstall() { + echo "Reinstall plugins" +} + +do_reinstall() { + if [[ -f "${PLUGINS}" ]]; then + local plugin + while read -r plugin; do + ls_plugin_wrapper install "${plugin}" + done < "${PLUGINS}" + fi +} + +### uninstall action +describe_uninstall() { + echo "Uninstall plugin" +} + +describe_uninstall_parameters() { + echo "<plugin>" +} + +do_uninstall() { + if [[ -f "${PLUGINS}" ]]; then + local plugin + for plugin; do + grep "^${plugin}\$" "${PLUGINS}" || write_warning_msg "Plugin ${plugin} not recorded" + sed -i "/^${plugin}\$/d" "${PLUGINS}" || die + ls_plugin_wrapper remove "${plugin}" + done + fi +} diff --git a/app-admin/logstash-bin/files/logstash.confd b/app-admin/logstash-bin/files/logstash.confd new file mode 100644 index 000000000000..6dbbe627a5ad --- /dev/null +++ b/app-admin/logstash-bin/files/logstash.confd @@ -0,0 +1,37 @@ +############################### +# Default settings for logstash +############################### + +# Set a home directory +#LS_HOME=/var/lib/logstash + +# Set data directory +#LS_DATA_DIR=${LS_HOME}/data + +# Arguments to pass to logstash agent +#LS_OPTS="" + +# Arguments to pass to java +#LS_HEAP_SIZE="500m" +#LS_JAVA_OPTS="-Djava.io.tmpdir=$HOME" + +# user id to be invoked as +#LS_USER=logstash +#LS_GROUP=logstash + +# logstash logging +#LS_LOG_DIR=/var/log/logstash +#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.confd-r1 b/app-admin/logstash-bin/files/logstash.confd-r1 new file mode 100644 index 000000000000..5f59b606fed2 --- /dev/null +++ b/app-admin/logstash-bin/files/logstash.confd-r1 @@ -0,0 +1,40 @@ +############################### +# Default settings for logstash +############################### + +# Set a home directory +#LS_HOME=/var/lib/logstash + +# Set data directory +#LS_DATA_DIR=${LS_HOME}/data + +# Arguments to pass to logstash agent +#LS_OPTS="" + +# Arguments to pass to java +#LS_HEAP_SIZE="500m" +#LS_JAVA_OPTS="-Djava.io.tmpdir=$HOME" + +# user id to be invoked as +#LS_USER=logstash +#LS_GROUP=logstash + +# logstash logging +#LS_LOG_DIR=/var/log/logstash +#LS_USE_GC_LOGGING="true" + +# logstash settings directory +#LS_SETTINGS_DIR=/etc/logstash + +# 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 b/app-admin/logstash-bin/files/logstash.initd new file mode 100644 index 000000000000..2133421377d6 --- /dev/null +++ b/app-admin/logstash-bin/files/logstash.initd @@ -0,0 +1,74 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 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_DIR=${LS_LOG_DIR:-/var/log/logstash} +LS_CONF_DIR=${LS_CONF_DIR:-/etc/logstash/conf.d} +LS_HOME=${LS_HOME:-/var/lib/logstash} +LS_DATA_DIR=${LS_DATA_DIR:-$LS_HOME/data} +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} + +LS_INSTALL_DIR="/opt/logstash" + +command="${LS_INSTALL_DIR}/bin/logstash" +command_args="--path.config ${LS_CONF_DIR} --path.logs ${LS_LOG_DIR} --path.data ${LS_DATA_DIR} ${LS_OPTS}" +command_background="true" +pidfile="/run/${RC_SVCNAME}.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" +extra_started_commands="reload" + +checkconfig() { + if [ ! -f ${LS_CONF_DIR}/* ]; then + eerror "Please put your configuration in ${LS_CONF_DIR}" + exit 1 + fi + + ebegin "Checking your configuration" + ${command} ${command_args} --path.logs "${LS_LOG_DIR}/configcheck" --config.test_and_exit + eend $? "Configuration error. Please fix your configuration files." +} + +reload() { + checkconfig || return 1 + ebegin "Reloading configuration" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} + +start_pre() { + checkconfig || return 1 + + rc_ulimit="-n ${LS_OPEN_FILES}" + + local d + for d in "${LS_HOME}" "${LS_DATA_DIR}" "${LS_DATA_DIR}/queue" "${LS_DATA_DIR}/dead_letter_queue" "${LS_LOG_DIR}"; do + checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$d" + done +} + +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.initd-r1 b/app-admin/logstash-bin/files/logstash.initd-r1 new file mode 100644 index 000000000000..2e7350d06f5a --- /dev/null +++ b/app-admin/logstash-bin/files/logstash.initd-r1 @@ -0,0 +1,75 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 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_DIR=${LS_LOG_DIR:-/var/log/logstash} +LS_SETTINGS_DIR=${LS_SETTINGS_DIR:-/etc/logstash} +LS_CONF_DIR=${LS_CONF_DIR:-/etc/logstash/conf.d} +LS_HOME=${LS_HOME:-/var/lib/logstash} +LS_DATA_DIR=${LS_DATA_DIR:-$LS_HOME/data} +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} + +LS_INSTALL_DIR="/opt/logstash" + +command="${LS_INSTALL_DIR}/bin/logstash" +command_args="--path.config ${LS_CONF_DIR} --path.data ${LS_DATA_DIR} --path.logs ${LS_LOG_DIR} --path.settings ${LS_SETTINGS_DIR} ${LS_OPTS}" +command_background="true" +pidfile="/run/${RC_SVCNAME}.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" +extra_started_commands="reload" + +checkconfig() { + if [ ! -f ${LS_CONF_DIR}/* ]; then + eerror "Please put your configuration in ${LS_CONF_DIR}" + exit 1 + fi + + ebegin "Checking your configuration" + ${command} ${command_args} --path.logs "${LS_LOG_DIR}/configcheck" --config.test_and_exit + eend $? "Configuration error. Please fix your configuration files." +} + +reload() { + checkconfig || return 1 + ebegin "Reloading configuration" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? +} + +start_pre() { + checkconfig || return 1 + + rc_ulimit="-n ${LS_OPEN_FILES}" + + local d + for d in "${LS_HOME}" "${LS_DATA_DIR}" "${LS_DATA_DIR}/queue" "${LS_DATA_DIR}/dead_letter_queue" "${LS_LOG_DIR}"; do + checkpath -d -o "${LS_USER}":"${LS_GROUP}" -m750 "$d" + done +} + +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 b/app-admin/logstash-bin/files/logstash.logrotate new file mode 100644 index 000000000000..013c8ea921b9 --- /dev/null +++ b/app-admin/logstash-bin/files/logstash.logrotate @@ -0,0 +1,6 @@ +/var/log/logstash/*.log { + copytruncate + compress + missingok + notifempty +} |