diff options
Diffstat (limited to 'app-admin/rsyslog/files/8-stable')
12 files changed, 730 insertions, 0 deletions
diff --git a/app-admin/rsyslog/files/8-stable/50-default-r1.conf b/app-admin/rsyslog/files/8-stable/50-default-r1.conf new file mode 100644 index 000000000000..920c214ff6ca --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/50-default-r1.conf @@ -0,0 +1,107 @@ +####################### +### DEFAULT ACTIONS ### +####################### + +auth,authpriv.* action( + name="action_auth" + type="omfile" + File="/var/log/auth.log" + FileCreateMode="0600" + FileOwner="root" + FileGroup="adm" + Sync="off" +) + +cron.* action( + name="action_cron" + type="omfile" + File="/var/log/cron.log" + FileOwner="root" + FileGroup="adm" +) + +daemon.* action( + name="action_daemon" + type="omfile" + File="/var/log/daemon.log" + FileOwner="root" + FileGroup="adm" +) + +kern.* action( + name="action_kern" + type="omfile" + File="/var/log/kern.log" + FileOwner="root" + FileGroup="adm" +) + +lpr.* action( + name="action_lpr" + type="omfile" + File="/var/log/lpr.log" + FileOwner="root" + FileGroup="adm" +) + +mail.* action( + name="action_mail" + type="omfile" + File="/var/log/mail.log" + FileOwner="root" + FileGroup="adm" +) + +news.* action( + name="action_news" + type="omfile" + File="/var/log/news.log" + FileOwner="root" + FileGroup="adm" +) + +user.* action( + name="action_user" + type="omfile" + File="/var/log/user.log" + FileOwner="root" + FileGroup="adm" +) + +*.=debug;auth,authpriv,news,mail.none action( + name="action_debug" + type="omfile" + File="/var/log/debug.log" + FileOwner="root" + FileGroup="adm" +) + +*.info;auth,authpriv,cron,daemon,lpr,mail,news.none action( + name="action_messages" + type="omfile" + File="/var/log/messages" + FileOwner="root" + FileGroup="adm" +) + +# Uncomment the following directive to re-enable the +# deprecated "/var/log/syslog" log file (don't forget to re-enable log +# rotation in "/etc/logrotate.d/rsyslog" if you do that!) +#*.*;auth,authpriv.none action( +# name="action_syslog" +# type="omfile" +# File="/var/log/syslog" +# FileOwner="root" +# FileGroup="adm" +#) + +*.emerg action( + name="action_emerge" + type="omusrmsg" + Users="*" + action.execOnlyOnceEveryInterval="10" +) + +# Create an additional socket for the default chroot location +# (used by net-misc/openssh[hpn], see https://bugs.gentoo.org/490744) +input(type="imuxsock" Socket="/var/empty/dev/log") diff --git a/app-admin/rsyslog/files/8-stable/50-default.conf b/app-admin/rsyslog/files/8-stable/50-default.conf new file mode 100644 index 000000000000..9ae8578215bb --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/50-default.conf @@ -0,0 +1,95 @@ +####################### +### DEFAULT ACTIONS ### +####################### + +auth,authpriv.* action( + type="omfile" + File="/var/log/auth.log" + FileCreateMode="0600" + FileOwner="root" + FileGroup="adm" + Sync="off" +) + +cron.* action( + type="omfile" + File="/var/log/cron.log" + FileOwner="root" + FileGroup="adm" +) + +daemon.* action( + type="omfile" + File="/var/log/daemon.log" + FileOwner="root" + FileGroup="adm" +) + +kern.* action( + type="omfile" + File="/var/log/kern.log" + FileOwner="root" + FileGroup="adm" +) + +lpr.* action( + type="omfile" + File="/var/log/lpr.log" + FileOwner="root" + FileGroup="adm" +) + +mail.* action( + type="omfile" + File="/var/log/mail.log" + FileOwner="root" + FileGroup="adm" +) + +news.* action( + type="omfile" + File="/var/log/news.log" + FileOwner="root" + FileGroup="adm" +) + +user.* action( + type="omfile" + File="/var/log/user.log" + FileOwner="root" + FileGroup="adm" +) + +*.=debug;auth,authpriv,news,mail.none action( + type="omfile" + File="/var/log/debug.log" + FileOwner="root" + FileGroup="adm" +) + +*.info;auth,authpriv,cron,daemon,lpr,mail,news.none action( + type="omfile" + File="/var/log/messages" + FileOwner="root" + FileGroup="adm" +) + +# Uncomment the following directive to re-enable the +# deprecated "/var/log/syslog" log file (don't forget to re-enable log +# rotation in "/etc/logrotate.d/rsyslog" if you do that!) +#*.*;auth,authpriv.none action( +# type="omfile" +# File="/var/log/syslog" +# FileOwner="root" +# FileGroup="adm" +#) + +*.emerg action( + type="omusrmsg" + Users="*" + action.execOnlyOnceEveryInterval="10" +) + +# Create an additional socket for the default chroot location +# (used by net-misc/openssh[hpn], see https://bugs.gentoo.org/490744) +input(type="imuxsock" Socket="/var/empty/dev/log") diff --git a/app-admin/rsyslog/files/8-stable/README.gentoo b/app-admin/rsyslog/files/8-stable/README.gentoo new file mode 100644 index 000000000000..9f0666c86b0a --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/README.gentoo @@ -0,0 +1,36 @@ +Introduction +============ + +Since rsyslog version 7.6 we are shipping a new default Gentoo +configuration. See bug #501982 to learn more about what we were trying to +achieve by rewriting the entire configuration. + + +Important changes +================= + +1. "/var/log/syslog" log file is now deprecated + + Beginning with rsyslog-7.6, the "/var/log/syslog" log file will no + longer being written per default. We are considering this file as + deprecated/obsolet for the typical user/system. + The content from this log file is still availble through other + (dedicated) log files, see + + - /var/log/cron.log + - /var/log/daemon.log + - /var/log/mail.log + - /var/log/messages + + If you really need the old "/var/log/syslog" log file, all you have to + do is uncommenting the corresponding configuration directive in + "/etc/rsyslog.d/50-default.conf". + + If you do so, don't forget to re-enable log rotation in + "/etc/logrotate.d/rsyslog", too. + + +2. An additional input socket in "/var/empty/dev/log" (default chroot + location) will be created per default + + See bug #490744 for further details. diff --git a/app-admin/rsyslog/files/8-stable/rsyslog-8.24.0-fix-tcpflood-without-librelp-r1.patch b/app-admin/rsyslog/files/8-stable/rsyslog-8.24.0-fix-tcpflood-without-librelp-r1.patch new file mode 100644 index 000000000000..a03a6562722a --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog-8.24.0-fix-tcpflood-without-librelp-r1.patch @@ -0,0 +1,160 @@ +Patch to allow building of tcpflood without librelp + +Cherry pick of +https://github.com/rsyslog/rsyslog/commit/73e3b7ab2f8a3974d31844b492ad02d61ed5727f +https://github.com/rsyslog/rsyslog/pull/1493 + + +Gentoo-Bug: https://bugs.gentoo.org/613264 +Gentoo-Bug: https://bugs.gentoo.org/614424 + +diff -u b/tests/tcpflood.c b/tests/tcpflood.c +--- b/tests/tcpflood.c ++++ b/tests/tcpflood.c +@@ -96,7 +96,9 @@ + #include <string.h> + #include <netinet/in.h> + #include <pthread.h> ++#ifdef ENABLE_RELP + #include <librelp.h> ++#endif + #include <sys/resource.h> + #include <sys/time.h> + #include <errno.h> +@@ -149,7 +151,9 @@ + static int numConnections = 1; /* number of connections to create */ + static int softLimitConnections = 0; /* soft connection limit, see -c option description */ + static int *sockArray; /* array of sockets to use */ ++#ifdef ENABLE_RELP + static relpClt_t **relpCltArray; /* array of sockets to use */ ++#endif + static int msgNum = 0; /* initial message number to start with */ + static int bShowProgress = 1; /* show progress messages */ + static int bSilent = 0; /* completely silent operation */ +@@ -216,6 +220,7 @@ + static int sendTLS(int i, char *buf, int lenBuf); + static void closeTLSSess(int __attribute__((unused)) i); + ++#ifdef ENABLE_RELP + /* RELP subsystem */ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wformat-security" +@@ -235,6 +240,7 @@ + CHKRELP(relpEngineSetEnableCmd(pRelpEngine, (unsigned char*)"syslog", + eRelpCmdState_Required)); + } ++#endif /* #ifdef ENABLE_RELP */ + + /* prepare send subsystem for UDP send */ + static int +@@ -273,6 +279,7 @@ + port = targetPort; + } + if(transport == TP_RELP_PLAIN) { ++ #ifdef ENABLE_RELP + relpRetVal relp_r; + relpClt_t *relpClt; + char relpPort[16]; +@@ -286,6 +293,7 @@ + return(1); + } + *fd = 1; /* mimic "all ok" state */ ++ #endif + } else { /* TCP, with or without TLS */ + if((sock=socket(AF_INET, SOCK_STREAM, 0))==-1) { + perror("\nsocket()"); +@@ -336,8 +344,10 @@ + sessArray = calloc(numConnections, sizeof(gnutls_session_t)); + # endif + sockArray = calloc(numConnections, sizeof(int)); ++ #ifdef ENABLE_RELP + if(transport == TP_RELP_PLAIN) + relpCltArray = calloc(numConnections, sizeof(relpClt_t*)); ++ #endif + for(i = 0 ; i < numConnections ; ++i) { + if(i % 10 == 0) { + if(bShowProgress) +@@ -356,8 +366,10 @@ + * at least something. + */ + if(transport == TP_RELP_PLAIN) { ++ #ifdef ENABLE_RELP + CHKRELP(relpEngineCltDestruct(pRelpEngine, + relpCltArray+i)); ++ #endif + } else { /* TCP and TLS modes */ + if(transport == TP_TLS) + closeTLSSess(i); +@@ -403,14 +415,13 @@ + + if(bShowProgress) + if(write(1, " close connections", sizeof(" close connections")-1)){} +- //if(transport == TP_RELP_PLAIN) +- //sleep(10); /* we need to let librelp settle a bit */ + for(i = 0 ; i < numConnections ; ++i) { + if(i % 10 == 0 && bShowProgress) { + lenMsg = sprintf(msgBuf, "\r%5.5d", i); + if(write(1, msgBuf, lenMsg)){} + } + if(transport == TP_RELP_PLAIN) { ++ #ifdef ENABLE_RELP + relpRetVal relpr; + if(sockArray[i] != -1) { + relpr = relpEngineCltDestruct(pRelpEngine, relpCltArray+i); +@@ -419,6 +430,7 @@ + } + sockArray[i] = -1; + } ++ #endif + } else { /* TCP and TLS modes */ + if(sockArray[i] != -1) { + /* we try to not overrun the receiver by trying to flush buffers +@@ -610,6 +622,7 @@ + offsSendBuf = lenBuf; + } + } else if(transport == TP_RELP_PLAIN) { ++ #ifdef ENABLE_RELP + relpRetVal relp_ret; + if(sockArray[socknum] == -1) { + /* connection was dropped, need to re-establish */ +@@ -627,6 +640,7 @@ + printf("\nrelpCltSendSyslog() failed with relp error code %d\n", + relp_ret); + } ++ #endif + } + if(lenSend != lenBuf) { + printf("\r%5.5d\n", i); +@@ -1106,7 +1120,9 @@ + transport = TP_RELP_PLAIN; + # else + fprintf(stderr, "compiled without RELP support: " +- "\"-Trelp-plain\" not supported!\n"); ++ "\"-Trelp-plain\" not supported!\n" ++ "(add --enable-relp to ./configure options " ++ "if desired)\n"); + exit(1); + # endif + } else { +@@ -1168,7 +1184,9 @@ + if(transport == TP_TLS) { + initTLS(); + } else if(transport == TP_RELP_PLAIN) { ++ #ifdef ENABLE_RELP + initRELP_PLAIN(); ++ #endif + } + + if(openConnections() != 0) { +@@ -1183,9 +1201,11 @@ + + closeConnections(); /* this is important so that we do not finish too early! */ + ++ #ifdef ENABLE_RELP + if(transport == TP_RELP_PLAIN) { + CHKRELP(relpEngineDestruct(&pRelpEngine)); + } ++ #endif + + if(nConnDrops > 0 && !bSilent) + printf("-D option initiated %ld connection closures\n", nConnDrops); diff --git a/app-admin/rsyslog/files/8-stable/rsyslog-8.26.0-fix-zmq3-format-security.patch b/app-admin/rsyslog/files/8-stable/rsyslog-8.26.0-fix-zmq3-format-security.patch new file mode 100644 index 000000000000..b285798bfe45 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog-8.26.0-fix-zmq3-format-security.patch @@ -0,0 +1,39 @@ +--- a/contrib/imzmq3/imzmq3.c ++++ b/contrib/imzmq3/imzmq3.c +@@ -403,7 +403,7 @@ static rsRetVal createSocket(instanceConf_t* info, void** sock) { + + /* Do the bind/connect... */ + if (info->action==ACTION_CONNECT) { +- rv = zsocket_connect(*sock, info->description); ++ rv = zsocket_connect(*sock, "%s", info->description); + if (rv == -1) { + errmsg.LogError(0, + RS_RET_INVALID_PARAMS, +@@ -413,7 +413,7 @@ static rsRetVal createSocket(instanceConf_t* info, void** sock) { + } + DBGPRINTF("imzmq3: connect for %s successful\n",info->description); + } else { +- rv = zsocket_bind(*sock, info->description); ++ rv = zsocket_bind(*sock, "%s", info->description); + if (rv == -1) { + errmsg.LogError(0, + RS_RET_INVALID_PARAMS, +--- a/contrib/omzmq3/omzmq3.c ++++ b/contrib/omzmq3/omzmq3.c +@@ -242,14 +242,14 @@ static rsRetVal initZMQ(instanceData* pData) { + if (pData->action == ACTION_BIND) { + /* bind asserts, so no need to test return val here + which isn't the greatest api -- oh well */ +- if(-1 == zsocket_bind(pData->socket, (char*)pData->description)) { ++ if(-1 == zsocket_bind(pData->socket, "%s", (char*)pData->description)) { + errmsg.LogError(0, RS_RET_NO_ERRCODE, "omzmq3: bind failed for %s: %s", + pData->description, zmq_strerror(errno)); + ABORT_FINALIZE(RS_RET_NO_ERRCODE); + } + DBGPRINTF("omzmq3: bind to %s successful\n",pData->description); + } else { +- if(-1 == zsocket_connect(pData->socket, (char*)pData->description)) { ++ if(-1 == zsocket_connect(pData->socket, "%s", (char*)pData->description)) { + errmsg.LogError(0, RS_RET_NO_ERRCODE, "omzmq3: connect failed for %s: %s", + pData->description, zmq_strerror(errno)); + ABORT_FINALIZE(RS_RET_NO_ERRCODE); diff --git a/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-hostname-detection-when-getaddrinfo-fails.patch b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-hostname-detection-when-getaddrinfo-fails.patch new file mode 100644 index 000000000000..a9470ccf4b60 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-hostname-detection-when-getaddrinfo-fails.patch @@ -0,0 +1,27 @@ +From 1a7d3a088969b47798bc1da712ca2772f91a7c02 Mon Sep 17 00:00:00 2001 +From: Jiri Vymazal <jvymazal@redhat.com> +Date: Wed, 31 May 2017 16:26:56 +0200 +Subject: [PATCH] Ignoring NONAME error from getaddrinfo so we have hostname + set even without working network + +--- + runtime/net.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/runtime/net.c b/runtime/net.c +index 2d8de9429..edffc677a 100644 +--- a/runtime/net.c ++++ b/runtime/net.c +@@ -1188,7 +1188,11 @@ getLocalHostname(uchar **ppName) + memset(&flags, 0, sizeof(flags)); + flags.ai_flags = AI_CANONNAME; + int error = getaddrinfo((char*)hnbuf, NULL, &flags, &res); +- if (error != 0) { ++ if (error != 0 && ++ error != EAI_NONAME && error != EAI_AGAIN && error != EAI_FAIL) { ++ /* If we get one of errors above, network is probably ++ * not working yet, so we fall back to local hostname below ++ */ + dbgprintf("getaddrinfo: %s\n", gai_strerror(error)); + ABORT_FINALIZE(RS_RET_IO_ERROR); + } diff --git a/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-librdkafka-detection.patch b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-librdkafka-detection.patch new file mode 100644 index 000000000000..366c0afaca84 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-librdkafka-detection.patch @@ -0,0 +1,43 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -1695,12 +1695,14 @@ AM_CONDITIONAL(ENABLE_KAFKA_TESTS, test x$enable_kafka_tests = xyes) + + # omkafka works with older library + if test "x$enable_omkafka" = "xyes"; then +- PKG_CHECK_MODULES([LIBRDKAFKA], [librdkafka],, [ +- AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ +- AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) +- LIBRDKAFKA_LIBS=-lrdkafka +- ], [ +- AC_MSG_ERROR([could not find rdkafka library]) ++ PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka],, [ ++ PKG_CHECK_MODULES([LIBRDKAFKA], [librdkafka],, [ ++ AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ ++ AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) ++ LIBRDKAFKA_LIBS=-lrdkafka ++ ], [ ++ AC_MSG_ERROR([could not find rdkafka library]) ++ ]) + ]) + ]) + AC_CHECK_HEADERS([librdkafka/rdkafka.h]) +@@ -1708,12 +1710,13 @@ fi + + # imkafka needs newer library + if test "x$enable_imkafka" = "xyes"; then +- PKG_CHECK_MODULES(LIBRDKAFKA, rdkafka >= 0.9.1) +- AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ +- AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) +- LIBRDKAFKA_LIBS=-lrdkafka +- ], [ +- AC_MSG_ERROR([could not find rdkafka library]) ++ PKG_CHECK_MODULES([LIBRDKAFKA], [rdkafka >= 0.9.1],, [ ++ AC_CHECK_LIB([rdkafka], [rd_kafka_produce], [ ++ AC_MSG_WARN([librdkafka is missing but library present, using -lrdkafka]) ++ LIBRDKAFKA_LIBS=-lrdkafka ++ ], [ ++ AC_MSG_ERROR([could not find rdkafka library]) ++ ]) + ]) + AC_CHECK_HEADERS([librdkafka/rdkafka.h]) + fi diff --git a/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-mmnormalize-tests.patch b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-mmnormalize-tests.patch new file mode 100644 index 000000000000..6ef7e6426287 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog-8.27.0-fix-mmnormalize-tests.patch @@ -0,0 +1,23 @@ +https://github.com/rsyslog/rsyslog/pull/1791 +--- + tests/Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -498,7 +498,6 @@ TESTS += msgvar-concurrency-array.sh \ + mmnormalize_processing_test2.sh \ + mmnormalize_processing_test3.sh \ + mmnormalize_processing_test4.sh +-endif + + if ENABLE_IMPTCP + TESTS += \ +@@ -512,6 +511,7 @@ if LOGNORM_REGEX_SUPPORTED + TESTS += \ + mmnormalize_regex.sh + endif ++endif + + if ENABLE_MMJSONPARSE + TESTS += \ diff --git a/app-admin/rsyslog/files/8-stable/rsyslog.conf b/app-admin/rsyslog/files/8-stable/rsyslog.conf new file mode 100644 index 000000000000..da484598a652 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog.conf @@ -0,0 +1,61 @@ +# /etc/rsyslog.conf +# +# This configuration is based on RainerScript, the new recommended syntax +# for RSYSLOG. See http://www.rsyslog.com/doc/rainerscript.html for further +# details. +# +# But if you don't want to learn something new at moment, don't worry: The +# legacy syntax is still supported. +# +# You may want to use the new RSYSLOG configuration builder to create your +# own more advanced configuration: http://www.rsyslog.com/rsyslog-configuration-builder/ + +# Check config syntax on startup and abort if unclean (default: off) +#$AbortOnUncleanConfig on + + +############### +### MODULES ### +############### + +# Read syslog messages from default Unix socket /dev/log (e.g. via logger command) +module(load="imuxsock") + +# Read messages from the kernel log and submits them to the syslog engine +module(load="imklog") + +# Inject "--MARK--" messages every $Interval (seconds) +#module(load="immark" Interval="600") + +# Read syslog messages from UDP +#module(load="imudp") +#input(type="imudp" port="514") + +# Read syslog messages from TCP +#module(load="imtcp") +#input(type="imtcp" port="514") + + +######################### +### GLOBAL DIRECTIVES ### +######################### + +# Where to place spool and state files +$WorkDirectory /var/spool/rsyslog + +# Reduce repeating messages (default: off) +#$RepeatedMsgReduction on + +# Set defaults for every output file +$Umask 0022 + +module( + load="builtin:omfile" + Template="RSYSLOG_TraditionalFileFormat" + FileCreateMode="0644" + DirCreateMode="0755" +) + + +# Include all conf files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf diff --git a/app-admin/rsyslog/files/8-stable/rsyslog.confd-r1 b/app-admin/rsyslog/files/8-stable/rsyslog.confd-r1 new file mode 100644 index 000000000000..da48c01cd407 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog.confd-r1 @@ -0,0 +1,30 @@ +# /etc/conf.d/rsyslog + +# Configuration file +#RSYSLOG_CONFIGFILE="/etc/rsyslog.conf" + +# PID file +# If you should ever change this, remember to update +# "/etc/logrotate.d/rsyslog", too. +#RSYSLOG_PIDFILE="/run/rsyslogd.pid" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +#RSYSLOG_SSDARGS="--wait 1000" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (60 + 5 seconds +# per default) when you are stopping the service. +# You need to increase the value when you are working with a large queue. +# See http://www.rsyslog.com/doc/queues.html for further information. +#RSYSLOG_TERMTIMEOUT="TERM/60/KILL/5" + + +# Options to rsyslogd +# See rsyslogd(8) for more details +# Notes: +# * Do not specify another PIDFILE but use the variable above to change the location +# * Do not specify another CONFIGFILE but use the variable above to change the location +#RSYSLOG_OPTS="" diff --git a/app-admin/rsyslog/files/8-stable/rsyslog.initd-r1 b/app-admin/rsyslog/files/8-stable/rsyslog.initd-r1 new file mode 100644 index 000000000000..7d7aa4bc9313 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog.initd-r1 @@ -0,0 +1,72 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +RSYSLOG_CONFIGFILE=${RSYSLOG_CONFIGFILE:-"/etc/rsyslog.conf"} +RSYSLOG_PIDFILE=${RSYSLOG_PIDFILE:-"/run/rsyslogd.pid"} +RSYSLOG_SSDARGS=${RSYSLOG_SSDARGS:-"--wait 1000"} +RSYSLOG_TERMTIMEOUT=${RSYSLOG_TERMTIMEOUT:-"TERM/60/KILL/5"} +RSYSLOG_OPTS=${RSYSLOG_OPTS:-""} + +command="/usr/sbin/rsyslogd" +command_args="${RSYSLOG_OPTS} -f \"${RSYSLOG_CONFIGFILE}\" -i \"${RSYSLOG_PIDFILE}\"" +start_stop_daemon_args="${RSYSLOG_SSDARGS}" +pidfile="${RSYSLOG_PIDFILE}" +retry="${RSYSLOG_TERMTIMEOUT}" + +required_files="${RSYSLOG_CONFIGFILE}" + +description="RSYSLOG is the rocket-fast system for log processing (syslog replacement)." + +extra_commands="configtest" +extra_started_commands="rotate" + +description_configtest="Run rsyslogd's internal config check." + +description_rotate="Sends rsyslogd a signal to re-open its log files." + +depend() { + need clock hostname localmount + provide logger +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +stop_post() { + if [ -f "${RSYSLOG_PIDFILE}" ]; then + vebegin "Removing stale PID file" + rm --force "${RSYSLOG_PIDFILE}" + veend $? + fi +} + +configtest() { + local _command_args="-N 999 -f \"${RSYSLOG_CONFIGFILE}\"" + local _retval=0 + + ebegin "Checking rsyslogd's configuration" + eval ${command} ${_command_args} >/dev/null 2>&1 + _retval=$? + + if [ ${_retval} -ne 0 ]; then + eval ${command} ${_command_args} + fi + + eend ${_retval} "failed, please correct errors above" +} + +rotate() { + ebegin "Re-opening rsyslogd logs" + start-stop-daemon --signal SIGHUP --pidfile "${RSYSLOG_PIDFILE}" + eend $? +} diff --git a/app-admin/rsyslog/files/8-stable/rsyslog.logrotate b/app-admin/rsyslog/files/8-stable/rsyslog.logrotate new file mode 100644 index 000000000000..1eae30e0d741 --- /dev/null +++ b/app-admin/rsyslog/files/8-stable/rsyslog.logrotate @@ -0,0 +1,37 @@ +# Uncomment the following directive if you have re-enabled +# "/var/log/syslog" in "/etc/rsyslog.d/50-default.conf" +#/var/log/syslog +#{ +# rotate 7 +# daily +# missingok +# notifempty +# delaycompress +# compress +# postrotate +# test -r /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid) &>/dev/null +# endscript +#} + +/var/log/auth.log +/var/log/cron.log +/var/log/daemon.log +/var/log/kern.log +/var/log/lpr.log +/var/log/mail.log +/var/log/news.log +/var/log/user.log +/var/log/debug.log +/var/log/messages +{ + rotate 4 + weekly + missingok + notifempty + compress + delaycompress + sharedscripts + postrotate + test -r /run/rsyslogd.pid && kill -HUP $(cat /run/rsyslogd.pid) &>/dev/null + endscript +} |