Build rsyslog from source on ubuntu/debian

Build rsyslog from source on ubuntu/debian

Script for build latest rsyslog from source on ubuntu/debian systems.

#!/bin/bash
RSYSLOG_VER="8.36.0"
LIBLOGNORM_VER="2.0.5"
LIBRELP_VER="1.2.14"
LIBFASTJSON_VER="0.99.8"
SYSTEM_RELEASE=`cat /etc/*release | grep VERSION_CODENAME | cut -d "=" -f 2`
DEPS="librelp-dev libsnmp-dev libqpid-proton2 git autoconf  libtool libqpid-proton2-dev libestr-dev  uuid-dev libgnutls-dev libgcrypt20-dev liblognorm-dev librdkafka-dev librabbitmq-dev checkinstall  libkrb5-dev libestr-dev pkg-config libpq-dev libcurl4-gnutls-dev libpcre3-dev libmaxminddb-dev"
ADD_DEPS="libfastjson-dev"
RSYSLOG_BUILD_PREF="--build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=${prefix}/lib/rsyslog --with-systemdsystemunitdir=/lib/systemd/system"
RSYSLOG_BUILD_FLAGS="--enable-pgsql --enable-mail --enable-imfile --enable-impstats --enable-gssapi-krb5 --enable-gnutls --enable-relp --enable-pmaixforwardedfrom --enable-pmcisconames --enable-pmlastmsg --enable-pmrfc3164sd --enable-pmsnare --enable-omprog --disable-testbench  --enable-snmp --enable-imptcp --enable-debug  --enable-omrabbitmq --enable-omuxsock --enable-omruleset --enable-impstats --enable-imptcp --enable-mmfields --enable-mmpstrucdata --enable-mmaudit --enable-mmjsonparse --enable-mmnormalize --enable-rsyslogd --enable-gnutls --enable-elasticsearch --enable-snmp --enable-regexp --enable-mmdblookup --enable-pmnormalize --enable-mmcount"
RSYSLOG_ADDITIONAL_MODULES="--enable-omamqp1 --enable-omkafka --enable-imkafka"
#RSYSLOG_DEP_TRAKING="--disable-dependency-tracking --enable-dependency-tracking"
RSYSLOG_DEP_TRAKING="--enable-dependency-tracking"
sudo apt-get install  ${DEPS} -y
if [ ! -f "libfastjson_v${LIBFASTJSON_VER}.tar.gz " ]; then
    echo "Скачиваем libfastjson_v${LIBFASTJSON_VER}.tar.gz "
wget https://github.com/rsyslog/libfastjson/archive/v$LIBFASTJSON_VER.tar.gz -O libfastjson-$LIBFASTJSON_VER.tar.gz
tar -xvf libfastjson-${LIBFASTJSON_VER}.tar.gz
cd libfastjson-${LIBFASTJSON_VER}
sh autogen.sh
./configure
make
sudo checkinstall  --install=no -D -y  --fstrans=yes --reset-uids=yes --pkgname=libfastjson --pkgversion=${LIBFASTJSON_VER} --pkgrelease="${SYSTEM_RELEASE}"  --arch=amd64 --pkglicense=GPL --maintainer="Alexander Galushko <a.v.galushko86@gmail.com>"
dpkg -i libfastjson_${LIBFASTJSON_VER}-${SYSTEM_RELEASE}_amd64.deb
fi
if [ ! -f "rsyslog-${RSYSLOG_VER}.tar.gz" ]; then
wget http://www.rsyslog.com/files/download/rsyslog/rsyslog-${RSYSLOG_VER}.tar.gz
tar -xvf rsyslog-${RSYSLOG_VER}.tar.gz
else
echo "FIle rsyslog-${RSYSLOG_VER}.tar.gz already downloaded "
fi
if [ ! -f "liblognorm-2.0.5.tar.gz" ]; then
wget http://www.liblognorm.com/files/download/liblognorm-${LIBLOGNORM_VER}.tar.gz
tar -xvf liblognorm-${LIBLOGNORM_VER}.tar.gz
cd liblognorm-${LIBLOGNORM_VER}
autoreconf -vfi
./configure --enable-regexp
checkinstall  --install=no -D -y  --fstrans=yes --reset-uids=yes --pkgname=liblognorm --pkgversion=${LIBLOGNORM_VER} --pkgrelease="${SYSTEM_RELEASE}" --arch=amd64 --pkglicense=GPL --maintainer="Alexander Galushko <a.v.galushko86@gmail.com>"
dpkg -i liblognorm_${LIBLOGNORM_VER}-${SYSTEM_RELEASE}_amd64.deb
else
echo "liblognorm ${LIBLOGNORM_VER}"
fi
if [ ! -f "librelp_${LIBRELP_VER}.orig.tar.gz" ]; then
wget https://launchpadlibrarian.net/353500630/librelp_${LIBRELP_VER}.orig.tar.gz
tar -xvf librelp_${LIBRELP_VER}.orig.tar.gz
cd librelp_${LIBRELP_VER}
autoreconf -vfi
./configure
checkinstall  --install=no -D -y  --fstrans=yes --reset-uids=yes --pkgname=librelp --pkgversion=${LIBRELP_VER}  --pkgrelease="${SYSTEM_RELEASE}" --arch=amd64 --pkglicense=GPL --maintainer="Alexander Galushko <a.v.galushko86@gmail.com>"
dpkg -i librelp_${LIBRELP_VER}-${SYSTEM_RELEASE}_amd64.deb
fi
cd rsyslog-${RSYSLOG_VER}
./configure   ${RSYSLOG_BUILD_PREF} ${RSYSLOG_BUILD_FLAGS} ${RSYSLOG_DEP_TRAKING}
make -j4
sudo mkdir -p /share /share/man
sudo checkinstall  --install=no -D -y  --fstrans=yes --reset-uids=yes --pkgname=rsyslog --pkgversion=${RSYSLOG_VER} --pkgrelease="${SYSTEM_RELEASE}" --arch=amd64 --pkglicense=GPL --maintainer="Alexander Galushko <a.v.galushko86@gmail.com>"
apt-get remove rsyslog-* rsyslog* -y
dpkg -i rsyslog_${RSYSLOG_VER}-${SYSTEM_RELEASE}_amd64.deb

Create supervisor config for rsyslog.

apt install -y supervisor

vi /etc/supervisor/conf.d/rsyslog.conf

[supervisord]
nodaemon=true
[program:rsyslog]
command=/usr/sbin/rsyslogd -n
autostart=true
autorestart=unexpected
stdout_logfile=/var/log/rsyslog.supervisor.log
stdout_logfile_maxbytes=0
stderr_logfile=/var/log/rsyslog.supervisor.err
stderr_logfile_maxbytes=0
exitcodes=0
[include]
files = /etc/supervisor/conf.d/*.conf

Update supervisor

supervisorctl update
supervisorctl status
supervisorctl restart rsyslog

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

 

Этот сайт использует Akismet для борьбы со спамом. Узнайте как обрабатываются ваши данные комментариев.