Accepting request 39733 from Base:System

Copy from Base:System/rsyslog based on submit request 39733 from user mtomaschewski

OBS-URL: https://build.opensuse.org/request/show/39733
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rsyslog?expand=0&rev=11
This commit is contained in:
OBS User autobuild 2010-05-13 23:04:22 +00:00 committed by Git OBS Bridge
parent 28a32503cd
commit 8737c542a0
4 changed files with 359 additions and 136 deletions

View File

@ -1,3 +1,32 @@
-------------------------------------------------------------------
Wed Apr 28 17:21:03 UTC 2010 - mt@suse.de
- Added $klogConsoleLogLevel 1 to the config, to use same default
[KERNEL_LOGLEVEL in /etc/sysconfig/syslog] as klogd (bnc#593699).
- Improved filter to discard iptables msgs higher err on console,
changed to set default file template instead per file, removed
duplicate filters (bnc#593699).
-------------------------------------------------------------------
Tue Apr 27 12:01:44 UTC 2010 - mt@suse.de
- Applied fix to avoid a tight send-retry loop in case there is
nobody receiving the messages sent to the xconsole pipe
(bnc#597293, http://bugzilla.adiscon.com/show_bug.cgi?id=186).
- Disabled relp support for < 11.3 (librelp is new)
- Fixed to create /var/run/rsyslog in post-install (rpmlint)
-------------------------------------------------------------------
Wed Apr 14 12:16:29 UTC 2010 - mrueckert@suse.de
- dropped install_all_modules_in_lib conditional and all related
code
- new subpackages
- enable RELP support. new depdendency librelp
- enable diagnotic tools.
- enable UDP spoof support. new dependency libnet
- moved module paths to 2 variables defined on top of the spec
-------------------------------------------------------------------
Tue Apr 13 08:56:15 UTC 2010 - mt@suse.de

View File

@ -19,108 +19,136 @@
# rsyslog v3: load input modules
# If you do not load inputs, nothing happens!
$ModLoad immark.so # provides --MARK-- message capability
$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
$ModLoad imklog.so # kernel logging (may be also provided by /sbin/klogd)
$ModLoad immark.so # provides --MARK-- message capability
$ModLoad imuxsock.so # provides support for local system logging (e.g. via logger command)
$ModLoad imklog.so # kernel logging (may be also provided by /sbin/klogd),
# see also http://www.rsyslog.com/doc-imklog.html.
$klogConsoleLogLevel 1 # set log level 1 (same as in /etc/sysconfig/syslog).
#
# Use traditional log format by default. To change it for a single
# file, append ";RSYSLOG_TraditionalFileFormat" to the filename.
#
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
#
# Include config generated by /etc/init.d/syslog script
# using the SYSLOGD_ADDITIONAL_SOCKET* variables in the
# /etc/sysconfig/syslog file.
#
$IncludeConfig ADDITIONAL_SOCKETS
$IncludeConfig /var/run/rsyslog/additional-log-sockets.conf
#
# Include config files, that the admin provided? :
#
$IncludeConfig ETC_RSYSLOG_D_GLOB
$IncludeConfig /etc/rsyslog.d/*.conf
###
# print most important on tty10 and on the xconsole pipe
#
# print most on tty10 and on the xconsole pipe
#
kern.warning;*.err;authpriv.none /dev/tty10;RSYSLOG_TraditionalFileFormat
kern.warning;*.err;authpriv.none |/dev/xconsole;RSYSLOG_TraditionalFileFormat
if ( \
/* kernel up to warning except of firewall */ \
($syslogfacility-text == 'kern') and \
($syslogseverity <= 4 /* warning */ ) and not \
($msg contains 'IN=' and $msg contains 'OUT=') \
) or ( \
/* up to errors except of facility authpriv */ \
($syslogseverity <= 3 /* errors */ ) and not \
($syslogfacility-text == 'authpriv') \
) \
then /dev/tty10
& |/dev/xconsole
# Emergency messages to everyone logged on (wall)
*.emerg *
# enable this, if you want that root is informed
# immediately, e.g. of logins
#*.alert root
#
# firewall messages into separate file and stop their further processing
#
if ($syslogfacility-text == 'kern') and \
($msg contains 'IN=' and $msg contains 'OUT=') then \
-/var/log/firewall;RSYSLOG_TraditionalFileFormat
if ($syslogfacility-text == 'kern') and \
($msg contains 'IN=' and $msg contains 'OUT=') then \
~
($msg contains 'IN=' and $msg contains 'OUT=') \
then -/var/log/firewall
& ~
#
# acpid messages into separate file and stop their further processing
#
# => all acpid messages for debuging (uncomment if needed):
#if ($programname == 'acpid' or $syslogtag == '[acpid]:') then \
# -/var/log/acpid;RSYSLOG_TraditionalFileFormat
# -/var/log/acpid
#
# => up to notice (skip info and debug)
if ($programname == 'acpid' or $syslogtag == '[acpid]:') and \
($syslogseverity <= 5) then \
-/var/log/acpid;RSYSLOG_TraditionalFileFormat
if ($programname == 'acpid' or $syslogtag == '[acpid]:') then \
~
($syslogseverity <= 5 /* notice */) \
then -/var/log/acpid
& ~
#
# NetworkManager into separate file and stop their further processing
#
if ($programname == 'NetworkManager') or \
($programname startswith 'nm-') then \
-/var/log/NetworkManager;RSYSLOG_TraditionalFileFormat
if ($programname == 'NetworkManager') or \
($programname startswith 'nm-') then \
~
($programname startswith 'nm-') \
then -/var/log/NetworkManager
& ~
#
# email-messages
#
mail.* -/var/log/mail;RSYSLOG_TraditionalFileFormat
mail.info -/var/log/mail.info;RSYSLOG_TraditionalFileFormat
mail.warning -/var/log/mail.warn;RSYSLOG_TraditionalFileFormat
mail.err /var/log/mail.err;RSYSLOG_TraditionalFileFormat
mail.* -/var/log/mail
mail.info -/var/log/mail.info
mail.warning -/var/log/mail.warn
mail.err /var/log/mail.err
#
# news-messages
#
news.crit -/var/log/news/news.crit;RSYSLOG_TraditionalFileFormat
news.err -/var/log/news/news.err;RSYSLOG_TraditionalFileFormat
news.notice -/var/log/news/news.notice;RSYSLOG_TraditionalFileFormat
news.crit -/var/log/news/news.crit
news.err -/var/log/news/news.err
news.notice -/var/log/news/news.notice
# enable this, if you want to keep all news messages
# in one file
#news.* -/var/log/news.all;RSYSLOG_TraditionalFileFormat
#news.* -/var/log/news.all
#
# Warnings in one file
#
*.=warning;*.=err -/var/log/warn;RSYSLOG_TraditionalFileFormat
*.crit /var/log/warn;RSYSLOG_TraditionalFileFormat
*.=warning;*.=err -/var/log/warn
*.crit /var/log/warn
#
# the rest in one file
#
*.*;mail.none;news.none -/var/log/messages;RSYSLOG_TraditionalFileFormat
*.*;mail.none;news.none -/var/log/messages
#
# enable this, if you want to keep all messages
# in one file
#*.* -/var/log/allmessages;RSYSLOG_TraditionalFileFormat
#*.* -/var/log/allmessages
#
# Some foreign boot scripts require local7
#
local0,local1.* -/var/log/localmessages;RSYSLOG_TraditionalFileFormat
local2,local3.* -/var/log/localmessages;RSYSLOG_TraditionalFileFormat
local4,local5.* -/var/log/localmessages;RSYSLOG_TraditionalFileFormat
local6,local7.* -/var/log/localmessages;RSYSLOG_TraditionalFileFormat
local0,local1.* -/var/log/localmessages
local2,local3.* -/var/log/localmessages
local4,local5.* -/var/log/localmessages
local6,local7.* -/var/log/localmessages
###

View File

@ -19,11 +19,18 @@
Name: rsyslog
%define upstream_version 5.4.0
%define rsyslog_docdir %{_docdir}/%{name}
%define install_all_modules_in_lib 0
%define upstream_version 5.4.0
# add %define build_with_relp 1 to enable relp on < 11.3, e.g.
# via <topadd>%define build_with_relp 1</topadd> in _link file.
%define with_relp 0%{?suse_version} >= 1130 || 0%{?build_with_relp:1}
%define _sbindir /sbin
%define rsyslogdocdir %{_docdir}/%{name}
%define additional_sockets %{_localstatedir}/run/rsyslog/additional-log-sockets.conf
%define _libdir /%_lib
%define rsyslog_module_dir_nodeps %{_libdir}/rsyslog/
%define rsyslog_module_dir_withdeps %{_prefix}/%{_lib}/rsyslog/
Version: 5.4.0
Release: 1
Release: 2
License: GPLv3+
Group: System/Daemons
Summary: Rsyslog, the enhanced syslogd for Linux and Unix
@ -35,6 +42,12 @@ BuildRequires: klogd
BuildRequires: dos2unix openssl-devel pcre-devel pkgconfig zlib-devel
BuildRequires: krb5-devel mysql-devel net-snmp-devel postgresql-devel
BuildRequires: libgnutls-devel
%if %{?with_relp}
# RELP support
BuildRequires: librelp-devel
%endif
# UDP spoof support
BuildRequires: libnet
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source0: http://download.rsyslog.com/rsyslog/%{name}-%{upstream_version}.tar.gz
Source0: %{name}-%{upstream_version}.tar.bz2
@ -42,10 +55,7 @@ Source1: rsyslog.sysconfig
Source2: rsyslog.conf.in
Source3: rsyslog.early.conf.in
Source4: rsyslog.d.remote.conf.in
%define _sbindir /sbin
%define _libdir /%_lib
%define rsyslogdocdir %{_docdir}/%{name}
%define additional_sockets %{_localstatedir}/run/rsyslog/additional-log-sockets.conf
Patch1: rsyslog.xconsole-pipe-loop.patch
%description
Rsyslog is an enhanced multi-threaded syslogd supporting, among others,
@ -56,13 +66,12 @@ Its advanced features make it suitable for enterprise-class, encryption
protected syslog relay chains while at the same time being very easy to
setup for the novice user.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package doc
License: GPLv3+
Group: System/Daemons
@ -75,13 +84,31 @@ package.
This package provides additional documentation for rsyslog.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package diag-tools
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: Diagnostic tools
%description diag-tools
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This package provides additional diagnostic tools (small helpers,
usually not needed).
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package module-gssapi
License: GPLv3+
Group: System/Daemons
@ -95,13 +122,12 @@ package.
This module provides the support to receive syslog messages from the
network protected via Kerberos 5 encryption and authentication.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package module-mysql
License: GPLv3+
Group: System/Daemons
@ -115,13 +141,12 @@ package.
This package provides a module with the support for logging into MySQL
databases.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package module-pgsql
License: GPLv3+
Group: System/Daemons
@ -134,13 +159,12 @@ package.
This module provides the support for logging into PostgreSQL databases.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package module-snmp
License: GPLv3+
Group: System/Daemons
@ -154,13 +178,12 @@ package.
This module provides the ability to send syslog messages as an SNMPv1 &
v2c traps.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%package module-gtls
License: GPLv3+
Group: System/Daemons
@ -174,27 +197,67 @@ package.
This module provides the ability for TLS encrypted TCP logging (based
on current syslog-transport-tls internet drafts).
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%if %{?with_relp}
%package module-relp
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: RELP protocol support module for syslog
%description module-relp
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides Reliable Event Logging Protocol support.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%endif
%package module-udpspoof
License: GPLv3+
Group: System/Daemons
Requires: %{name} = %{version}
Summary: UDP spoof support module for syslog
%description module-udpspoof
Rsyslog is an enhanced multi-threaded syslog daemon. See rsyslog
package.
This module provides a UDP forwarder that allows changing the sender address.
Authors:
--------
Rainer Gerhards <rgerhards@adiscon.com>, Adiscon GmbH
Michael Meckelein <mmeckelein@hq.adiscon.com>, Adiscon GmbH
%prep
%setup -q -n %{name}-%{upstream_version}
dos2unix doc/*.html
%patch1 -p1
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -W -Wall"
%if 0%{?suse_version} > 1000 && 0%{?suse_version} < 1030
export CFLAGS="$CFLAGS -fstack-protector"
%endif
autoreconf -fi
# needs liblogging
# --enable-rfc3195 \
# needs java
# --enable-gui \
%configure \
%if ! 0%{install_all_modules_in_lib}
--with-moddirs=%{_prefix}%{_libdir}/rsyslog/ \
%endif
--with-moddirs=%{rsyslog_module_dir_withdeps} \
--enable-option-checking \
--enable-largefile \
--enable-pthreads \
@ -213,25 +276,33 @@ autoreconf -fi
--enable-imtemplate \
--enable-omprog \
--enable-omtemplate \
--enable-diagtools \
%if %{?with_relp}
--enable-relp \
%endif
--enable-omudpspoof \
--enable-omstdout \
--disable-static
make %{?_smp_mflags:%{_smp_mflags}}
make %{?_smp_mflags:%{_smp_mflags}} V=1
%install
make install DESTDIR="%{buildroot}"
make install DESTDIR="%{buildroot}" V=1
#
rm -f %{buildroot}%{_libdir}/rsyslog/*.la
rm -f %{buildroot}%{rsyslog_module_dir_nodeps}/*.la
#
%if ! 0%{install_all_modules_in_lib}
# move all modules linking libraries in /usr to /usr/%_lib
# the user has to specify them with full path then...
install -d -m0755 %{buildroot}%{_prefix}%{_libdir}/rsyslog
install -d -m0755 %{buildroot}%{rsyslog_module_dir_withdeps}
for mod in omgssapi.so imgssapi.so lmgssutil.so ommysql.so \
ompgsql.so omsnmp.so lmnsd_gtls.so ;
do
mv -f %{buildroot}%{_libdir}/rsyslog/$mod \
%{buildroot}%{_prefix}%{_libdir}/rsyslog/
done
ompgsql.so omsnmp.so lmnsd_gtls.so \
%if %{?with_relp}
imrelp.so omrelp.so \
%endif
; do
mv -f %{buildroot}%{rsyslog_module_dir_nodeps}/$mod \
%{buildroot}%{rsyslog_module_dir_withdeps}
done
#
install -d -m0755 %{buildroot}%{_sysconfdir}/rsyslog.d
install -d -m0755 %{buildroot}%{_localstatedir}/run/rsyslog
@ -339,7 +410,9 @@ touch var/log/NetworkManager; chmod 640 var/log/NetworkManager
# touch the additional log sockets config file
#
additional_sockets="%{additional_sockets}"
touch "${additional_sockets#/}"; chmod 640 "${additional_sockets#/}"
mkdir -p -m750 ${additional_sockets%/*}
touch "${additional_sockets#/}"
chmod 640 "${additional_sockets#/}"
%preun
#
@ -378,30 +451,29 @@ fi
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.early.conf
%config(noreplace) %attr(600,root,root) %{_sysconfdir}/rsyslog.d/remote.conf
%{_sbindir}/rsyslogd
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/imfile.so
%{_libdir}/rsyslog/imklog.so
%{_libdir}/rsyslog/immark.so
%{_libdir}/rsyslog/imtcp.so
%{_libdir}/rsyslog/imtemplate.so
%{_libdir}/rsyslog/imudp.so
%{_libdir}/rsyslog/imuxsock.so
%{_libdir}/rsyslog/lmnet.so
%{_libdir}/rsyslog/lmnetstrms.so
%{_libdir}/rsyslog/lmnsd_ptcp.so
%{_libdir}/rsyslog/lmregexp.so
%{_libdir}/rsyslog/lmstrmsrv.so
%{_libdir}/rsyslog/lmtcpclt.so
%{_libdir}/rsyslog/lmtcpsrv.so
%{_libdir}/rsyslog/lmzlibw.so
%{_libdir}/rsyslog/ommail.so
%{_libdir}/rsyslog/omprog.so
%{_libdir}/rsyslog/omruleset.so
%{_libdir}/rsyslog/omtemplate.so
%{_libdir}/rsyslog/omtesting.so
%if ! 0%{install_all_modules_in_lib}
%dir %{_prefix}%{_libdir}/rsyslog
%endif
%dir %{rsyslog_module_dir_nodeps}
%{rsyslog_module_dir_nodeps}/imfile.so
%{rsyslog_module_dir_nodeps}/imklog.so
%{rsyslog_module_dir_nodeps}/immark.so
%{rsyslog_module_dir_nodeps}/imtcp.so
%{rsyslog_module_dir_nodeps}/imtemplate.so
%{rsyslog_module_dir_nodeps}/imudp.so
%{rsyslog_module_dir_nodeps}/imuxsock.so
%{rsyslog_module_dir_nodeps}/lmnet.so
%{rsyslog_module_dir_nodeps}/lmnetstrms.so
%{rsyslog_module_dir_nodeps}/lmnsd_ptcp.so
%{rsyslog_module_dir_nodeps}/lmregexp.so
%{rsyslog_module_dir_nodeps}/lmstrmsrv.so
%{rsyslog_module_dir_nodeps}/lmtcpclt.so
%{rsyslog_module_dir_nodeps}/lmtcpsrv.so
%{rsyslog_module_dir_nodeps}/lmzlibw.so
%{rsyslog_module_dir_nodeps}/ommail.so
%{rsyslog_module_dir_nodeps}/omprog.so
%{rsyslog_module_dir_nodeps}/omruleset.so
%{rsyslog_module_dir_nodeps}/omtemplate.so
%{rsyslog_module_dir_nodeps}/omtesting.so
%{rsyslog_module_dir_nodeps}/omstdout.so
%dir %{rsyslog_module_dir_withdeps}
%{_mandir}/man5/rsyslog.conf.5*
%{_mandir}/man8/rsyslogd.8*
%dir %{rsyslogdocdir}
@ -411,7 +483,6 @@ fi
%doc %{rsyslogdocdir}/AUTHORS
%doc %{rsyslogdocdir}/COPYING
%doc %{rsyslogdocdir}/COPYING.LESSER
%dir %{_localstatedir}/run/rsyslog
%dir %{_localstatedir}/spool/rsyslog
/var/adm/fillup-templates/sysconfig.syslog-rsyslog
@ -420,60 +491,46 @@ fi
%dir %{rsyslogdocdir}
%doc %{rsyslogdocdir}/doc
%files diag-tools
%defattr(-,root,root)
%{_sbindir}/msggen
%{_sbindir}/rsyslog_diag_hostname
%{_sbindir}/zpipe
%files module-gssapi
%defattr(-,root,root)
%if 0%{install_all_modules_in_lib}
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/omgssapi.so
%{_libdir}/rsyslog/imgssapi.so
%{_libdir}/rsyslog/lmgssutil.so
%else
%dir %{_prefix}%{_libdir}/rsyslog
%{_prefix}%{_libdir}/rsyslog/omgssapi.so
%{_prefix}%{_libdir}/rsyslog/imgssapi.so
%{_prefix}%{_libdir}/rsyslog/lmgssutil.so
%endif
%{rsyslog_module_dir_withdeps}/omgssapi.so
%{rsyslog_module_dir_withdeps}/imgssapi.so
%{rsyslog_module_dir_withdeps}/lmgssutil.so
%files module-mysql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/mysql-createDB.sql
%if 0%{install_all_modules_in_lib}
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/ommysql.so
%else
%dir %{_prefix}%{_libdir}/rsyslog
%{_prefix}%{_libdir}/rsyslog/ommysql.so
%endif
%{rsyslog_module_dir_withdeps}/ommysql.so
%files module-pgsql
%defattr(-,root,root)
%doc %{rsyslogdocdir}/pgsql-createDB.sql
%if 0%{install_all_modules_in_lib}
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/ompgsql.so
%else
%dir %{_prefix}%{_libdir}/rsyslog
%{_prefix}%{_libdir}/rsyslog/ompgsql.so
%endif
%{rsyslog_module_dir_withdeps}/ompgsql.so
%files module-snmp
%defattr(-,root,root)
%if 0%{install_all_modules_in_lib}
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/omsnmp.so
%else
%dir %{_prefix}%{_libdir}/rsyslog
%{_prefix}%{_libdir}/rsyslog/omsnmp.so
%endif
%{rsyslog_module_dir_withdeps}/omsnmp.so
%files module-gtls
%defattr(-,root,root)
%if 0%{install_all_modules_in_lib}
%dir %{_libdir}/rsyslog
%{_libdir}/rsyslog/lmnsd_gtls.so
%else
%dir %{_prefix}%{_libdir}/rsyslog
%{_prefix}%{_libdir}/rsyslog/lmnsd_gtls.so
%{rsyslog_module_dir_withdeps}/lmnsd_gtls.so
%if %{?with_relp}
%files module-relp
%defattr(-,root,root)
%{rsyslog_module_dir_withdeps}/imrelp.so
%{rsyslog_module_dir_withdeps}/omrelp.so
%endif
%files module-udpspoof
%defattr(-,root,root)
%{rsyslog_module_dir_nodeps}/omudpspoof.so
%changelog

View File

@ -0,0 +1,109 @@
Fix for:
https://bugzilla.novell.com/show_bug.cgi?id=597293
Extracted the bare fix (without ChangeLog and testcase) to test if it
solves the problem from:
http://bugzilla.adiscon.com/show_bug.cgi?id=186
http://git.adiscon.com/?p=rsyslog.git;a=commitdiff;h=eec894fbc5eb263e6def1f2e35f9882967c95a88
Rainer Gerhards [Mon, 26 Apr 2010 13:19:13 +0000 (15:19 +0200)]
The rsyslog engine did not guard itself against output modules that do
not properly convey back the tryResume() behaviour. This then leads to
what looks like an endless loop. I consider this to be a bug of the
engine not only because it should be hardened against plugin misbehaviour,
but also because plugins may not be totally able to avoid this situation
(depending on the type of and processing done by the plugin).
* Unmerged path ChangeLog
diff --git a/action.c b/action.c
index aaf4559..256ca09 100644
--- a/action.c
+++ b/action.c
@@ -445,6 +445,7 @@ static void actionCommitted(action_t *pThis)
static void actionRetry(action_t *pThis)
{
actionSetState(pThis, ACT_STATE_RTRY);
+ pThis->iResumeOKinRow++;
}
@@ -480,23 +481,39 @@ static inline void actionSuspend(action_t *pThis, time_t ttNow)
/* actually do retry processing. Note that the function receives a timestamp so
* that we do not need to call the (expensive) time() API.
* Note that we do the full retry processing here, doing the configured number of
- * iterations.
- * rgerhards, 2009-05-07
+ * iterations. -- rgerhards, 2009-05-07
+ * We need to guard against module which always return RS_RET_OK from their tryResume()
+ * entry point. This is invalid, but has harsh consequences: it will cause the rsyslog
+ * engine to go into a tight loop. That obviously is not acceptable. As such, we track the
+ * count of iterations that a tryResume returning RS_RET_OK is immediately followed by
+ * an unsuccessful call to doAction(). If that happens more than 1,000 times, we assume
+ * the return acutally is a RS_RET_SUSPENDED. In order to go through the various
+ * resumption stages, we do this for every 1000 requests. This magic number 1000 may
+ * not be the most appropriate, but it should be thought of a "if nothing else helps"
+ * kind of facility: in the first place, the module should return a proper indication
+ * of its inability to recover. -- rgerhards, 2010-04-26.
*/
static rsRetVal actionDoRetry(action_t *pThis, time_t ttNow)
{
int iRetries;
int iSleepPeriod;
+ int bTreatOKasSusp;
DEFiRet;
ASSERT(pThis != NULL);
iRetries = 0;
while(pThis->eState == ACT_STATE_RTRY) {
+dbgprintf("YYY: resume in row %d\n", pThis->iResumeOKinRow);
iRet = pThis->pMod->tryResume(pThis->pModData);
- if(iRet == RS_RET_OK) {
+ if((pThis->iResumeOKinRow > 999) && (pThis->iResumeOKinRow % 1000 == 0)) {
+ bTreatOKasSusp = 1;
+ } else {
+ bTreatOKasSusp = 0;
+ }
+ if((iRet == RS_RET_OK) && (!bTreatOKasSusp)) {
actionSetState(pThis, ACT_STATE_RDY);
- } else if(iRet == RS_RET_SUSPENDED) {
+ } else if(iRet == RS_RET_SUSPENDED || bTreatOKasSusp) {
/* max retries reached? */
if((pThis->iResumeRetryCount != -1 && iRetries >= pThis->iResumeRetryCount)) {
actionSuspend(pThis, ttNow);
@@ -715,13 +732,16 @@ actionCallDoAction(action_t *pThis, msg_t *pMsg)
switch(iRet) {
case RS_RET_OK:
actionCommitted(pThis);
+ pThis->iResumeOKinRow = 0; /* we had a successful call! */
break;
case RS_RET_DEFER_COMMIT:
+ pThis->iResumeOKinRow = 0; /* we had a successful call! */
/* we are done, action state remains the same */
break;
case RS_RET_PREVIOUS_COMMITTED:
/* action state remains the same, but we had a commit. */
pThis->bHadAutoCommit = 1;
+ pThis->iResumeOKinRow = 0; /* we had a successful call! */
break;
case RS_RET_SUSPENDED:
actionRetry(pThis);
diff --git a/action.h b/action.h
index 6cc4df5..4a6c3c8 100644
--- a/action.h
+++ b/action.h
@@ -56,8 +56,9 @@ struct action_s {
bool bWriteAllMarkMsgs;/* should all mark msgs be written (not matter how recent the action was executed)? */
int iSecsExecOnceInterval; /* if non-zero, minimum seconds to wait until action is executed again */
action_state_t eState; /* current state of action */
- int bHadAutoCommit; /* did an auto-commit happen during doAction()? */
+ bool bHadAutoCommit; /* did an auto-commit happen during doAction()? */
time_t ttResumeRtry; /* when is it time to retry the resume? */
+ int iResumeOKinRow; /* number of times in a row that resume said OK with an immediate failure following */
int iResumeInterval;/* resume interval for this action */
int iResumeRetryCount;/* how often shall we retry a suspended action? (-1 --> eternal) */
int iNbrResRtry; /* number of retries since last suspend */