diff options
author | André Geraldo Vieira <andre.geraldo@gmail.com> | 2023-07-16 09:57:08 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2023-07-16 09:57:08 +0700 |
commit | b575e234366e1aaea2cc1d4039097728c93ba506 (patch) | |
tree | 07da5838ca23e00bf0411d12cb3bd86b6f74d5cb /system/graylog-sidecar | |
parent | cc0c902d50cd0f87b40bdd29650c02cf60b82074 (diff) |
system/graylog-sidecar: Added (configuration management system).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/graylog-sidecar')
-rw-r--r-- | system/graylog-sidecar/README | 20 | ||||
-rw-r--r-- | system/graylog-sidecar/doinst.sh | 24 | ||||
-rw-r--r-- | system/graylog-sidecar/graylog-sidecar.SlackBuild | 90 | ||||
-rw-r--r-- | system/graylog-sidecar/graylog-sidecar.info | 10 | ||||
-rw-r--r-- | system/graylog-sidecar/rc.graylog-sidecar | 50 | ||||
-rw-r--r-- | system/graylog-sidecar/slack-desc | 19 |
6 files changed, 213 insertions, 0 deletions
diff --git a/system/graylog-sidecar/README b/system/graylog-sidecar/README new file mode 100644 index 000000000000..b755f54bd316 --- /dev/null +++ b/system/graylog-sidecar/README @@ -0,0 +1,20 @@ +graylog-sidecar (is a lightweight configuration management system) + +Graylog Sidecar is a lightweight configuration management system for +different log collectors, also called Backends. The Graylog node(s) +acts as a centralized hub containing the configurations of log +collectors. On supported message-producing devices/hosts, Sidecar +can run as a service (Windows host) or daemon (Linux host). + +https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html + +Add this to /etc/rc.d/rc.local: +if [ -x /etc/rc.d/rc.graylog-sidecar ]; then + /etc/rc.d/rc.graylog-sidecar start +fi + +Add this to /etc/rc.d/rc.local_shutdown +if [ -x /etc/rc.d/rc.graylog-sidecar ]; then + /etc/rc.d/rc.graylog-sidecar stop +fi + diff --git a/system/graylog-sidecar/doinst.sh b/system/graylog-sidecar/doinst.sh new file mode 100644 index 000000000000..da8202339ac4 --- /dev/null +++ b/system/graylog-sidecar/doinst.sh @@ -0,0 +1,24 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then + rm $NEW + fi +} + +preserve_perms() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + if [ -e $OLD ]; then + cp -a $OLD ${NEW}.incoming + cat $NEW > ${NEW}.incoming + mv ${NEW}.incoming $NEW + fi + config $NEW +} + +preserve_perms etc/rc.d/rc.graylog-sidecar.new +preserve_perms etc/graylog/sidecar/sidecar.yml.new + diff --git a/system/graylog-sidecar/graylog-sidecar.SlackBuild b/system/graylog-sidecar/graylog-sidecar.SlackBuild new file mode 100644 index 000000000000..804974f9082c --- /dev/null +++ b/system/graylog-sidecar/graylog-sidecar.SlackBuild @@ -0,0 +1,90 @@ +#!/bin/bash + +# Slackware build script for graylog-sidecar + +# Copyright 2023 André Geraldo Vieira <andre.geraldo@gmail.com> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=graylog-sidecar +SRCNAM=collector-sidecar +VERSION=${VERSION:-1.4.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-$VERSION +tar xvf $CWD/$SRCNAM-$VERSION.tar.gz +cd $SRCNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +make + +mkdir -p $PKG/etc/{graylog/sidecar/,rc.d} +mkdir -p $PKG/usr/bin +mkdir -p $PKG/var/{lib/graylog-sidecar/generated,log/graylog-sidecar,run/graylog-sidecar} + +cp sidecar-example.yml $PKG/etc/graylog/sidecar/sidecar.yml.new +cp $CWD/rc.graylog-sidecar $PKG/etc/rc.d/rc.graylog-sidecar.new +cp graylog-sidecar $PKG/usr/bin + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a \ + README.md CODE_OF_CONDUCT.md LICENSE \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc +cat $CWD/doinst.sh > $PKG/install/doinst.sh + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE diff --git a/system/graylog-sidecar/graylog-sidecar.info b/system/graylog-sidecar/graylog-sidecar.info new file mode 100644 index 000000000000..2816c5d27b8c --- /dev/null +++ b/system/graylog-sidecar/graylog-sidecar.info @@ -0,0 +1,10 @@ +PRGNAM="graylog-sidecar" +VERSION="1.4.0" +HOMEPAGE="https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar.html" +DOWNLOAD="https://github.com/Graylog2/collector-sidecar/archive/refs/tags/1.4.0/collector-sidecar-1.4.0.tar.gz" +MD5SUM="a1f862c650f369ea9af68e64316fa6d1" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="André Geraldo Vieira" +EMAIL="andre.geraldo@gmail.com" diff --git a/system/graylog-sidecar/rc.graylog-sidecar b/system/graylog-sidecar/rc.graylog-sidecar new file mode 100644 index 000000000000..956e22f73c88 --- /dev/null +++ b/system/graylog-sidecar/rc.graylog-sidecar @@ -0,0 +1,50 @@ +#!/bin/bash + +PIDOF_CMD=/sbin/pidof +ECHO_CMD=/usr/bin/echo +SLEEP_CMD=/usr/bin/sleep +KILL_CMD=/bin/kill + +NAME=graylog-sidecar +GRAYLOG_CMD=${GRAYLOG_CMD-/usr/bin/${NAME}} + +graylog_sidecar_start() { + if [ -n "$($PIDOF_CMD graylog-sidecar)" ]; then + $ECHO_CMD "Graylog Sidecar seems to be already running." + return + fi + + $ECHO_CMD "Starting Graylog Sidecar." + $GRAYLOG_CMD & +} + +graylog_sidecar_stop() { + if [ -z "$($PIDOF_CMD graylog-sidecar)" ]; then + $ECHO_CMD "Graylog Sidecar does not seem to be running." + return + fi + + $ECHO_CMD "Stopping Graylog Sidecar." + $KILL_CMD $($PIDOF_CMD graylog-sidecar) +} + +graylog_sidecar_restart() { + $ECHO_CMD "Restarting Graylog Sidecar." + graylog_sidecar_stop + $SLEEP_CMD 5 + graylog_sidecar_start +} + +case "$1" in +'start') + graylog_sidecar_start + ;; +'stop') + graylog_sidecar_stop + ;; +'restart') + graylog_sidecar_restart + ;; +*) + echo "usage: $0 start|stop|restart" +esac diff --git a/system/graylog-sidecar/slack-desc b/system/graylog-sidecar/slack-desc new file mode 100644 index 000000000000..69fcd3c28647 --- /dev/null +++ b/system/graylog-sidecar/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +graylog-sidecar: graylog-sidecar (lightweight configuration management system) +graylog-sidecar: +graylog-sidecar: Graylog Sidecar is a lightweight configuration management system for +graylog-sidecar: different log collectors, also called Backends. The Graylog node(s) +graylog-sidecar: acts as a centralized hub containing the configurations of log +graylog-sidecar: collectors. On supported message-producing devices/hosts, Sidecar +graylog-sidecar: can run as a service (Windows host) or daemon (Linux host). +graylog-sidecar: +graylog-sidecar: https://go2docs.graylog.org/5-0/getting_in_log_data/graylog_sidecar +graylog-sidecar: .html +graylog-sidecar: |