summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--ChangeLog224
-rw-r--r--Makefile.am2
-rw-r--r--action.c34
-rw-r--r--action.h2
-rw-r--r--build/rhel/README17
-rw-r--r--build/rhel/dependencies/czmq.spec107
-rw-r--r--build/rhel/dependencies/zeromq.spec142
-rw-r--r--build/rhel/libee/libee.spec90
-rw-r--r--build/rhel/libestr/libestr.spec56
-rw-r--r--build/rhel/liblognorm/liblognorm.spec70
-rw-r--r--build/rhel/librelp/librelp.spec65
-rw-r--r--build/rhel/rsyslog/rsyslog.conf80
-rw-r--r--build/rhel/rsyslog/rsyslog.init121
-rw-r--r--build/rhel/rsyslog/rsyslog.log8
-rw-r--r--build/rhel/rsyslog/rsyslog.spec786
-rw-r--r--build/rhel/rsyslog/rsyslog.sysconfig7
-rw-r--r--configure.ac42
-rw-r--r--doc/manual.html2
-rw-r--r--doc/omudpspoof.html20
-rw-r--r--doc/property_replacer.html9
-rw-r--r--grammar/Makefile.am8
-rw-r--r--grammar/rainerscript.c21
-rw-r--r--plugins/imklog/imklog.c18
-rw-r--r--plugins/imklog/imklog.h16
-rw-r--r--plugins/imptcp/imptcp.c5
-rw-r--r--plugins/ommongodb/README15
-rw-r--r--plugins/ommysql/ommysql.c20
-rw-r--r--plugins/omudpspoof/omudpspoof.c28
-rw-r--r--runtime/cfsysline.c21
-rw-r--r--runtime/debug.c4
-rw-r--r--runtime/debug.h1
-rw-r--r--runtime/modules.c31
-rw-r--r--runtime/msg.c131
-rw-r--r--runtime/obj.c4
-rw-r--r--runtime/obj.h4
-rw-r--r--runtime/queue.c69
-rw-r--r--runtime/rsconf.c4
-rw-r--r--runtime/srUtils.h13
-rw-r--r--tcpsrv.c65
-rw-r--r--template.c40
-rw-r--r--template.h1
-rw-r--r--tests/Makefile.am4
-rwxr-xr-xtests/imuxsock_ccmiddle_root.sh3
-rwxr-xr-xtests/imuxsock_logger_root.sh3
-rwxr-xr-xtests/imuxsock_traillf_root.sh3
-rwxr-xr-xtests/sndrcv_udp.sh3
-rw-r--r--tests/tcpflood.c4
-rw-r--r--threads.c34
-rw-r--r--threads.h3
-rw-r--r--tools/omfile.c2
-rw-r--r--tools/pmrfc3164.c2
-rw-r--r--tools/pmrfc5424.c4
-rw-r--r--tools/syslogd.c13
54 files changed, 2179 insertions, 303 deletions
diff --git a/.gitignore b/.gitignore
index 55f069ee..b24a0666 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@ missing
compile
rsyslogd
rsyslog.service
+ylwrap
*.orig
rg.conf*
*.swp
diff --git a/ChangeLog b/ChangeLog
index e22967e5..d577b765 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,50 @@
---------------------------------------------------------------------------
-Version 6.3.9 [DEVEL] 2012-04-??
+Version 6.3.12 [BETA] 2012-06-18
+- bugfix: $ActionName was not properly honored
+ Thanks to Abby Edwards for alerting us
+---------------------------------------------------------------------------
+Version 6.3.11 [BETA] 2012-06-18
+- bugfix: expression-based filters with AND/OR could segfault
+ due to a problem with boolean shortcut operations. From the user's
+ perspective, the segfault is almost non-deterministic (it occurs when
+ a shortcut is used).
+ Thanks to Lars Peterson for providing the initial bug report and his
+ support in solving it.
+- bugfix: "last message repeated n times" message was missing hostname
+ Thanks to Zdenek Salvet for finding this bug and to Bodik for reporting
+---------------------------------------------------------------------------
+Version 6.3.10 [BETA] 2012-06-04
+- bugfix: delayble source could block action queue, even if there was
+ a disk queue associated with it. The root cause of this problem was
+ that it makes no sense to delay messages once they arrive in the
+ action queue - the "input" that is being held in that case is the main
+ queue worker, what makes no sense.
+ Thanks to Marcin for alerting us on this problem and providing
+ instructions to reproduce it.
+- bugfix: invalid free in imptcp could lead to abort during startup
+- bugfix: if debug message could end up in log file when forking
+ if rsyslog was set to auto-background (thus fork, the default) and debug
+ mode to stdout was enabled, debug messages ended up in the first log file
+ opened. Currently, stdout logging is completely disabled in forking mode
+ (but writing to the debug log file is still possible). This is a change
+ in behaviour, which is under review. If it causes problems to you,
+ please let us know.
+ Thanks to Tomas Heinrich for the patch.
+- bugfix: --enable-smcustbindcdr configure directive did not work
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=330
+ Thanks to Ultrabug for the patch.
+- bugfix: made rsyslog compile when libestr ist not installed in /usr
+ Thanks to Miloslav Trmač for providing patches and suggestions
+---------------------------------------------------------------------------
+Version 6.3.9 [BETA] 2012-05-22
+- bugfix: imtcp could cause hang during reception
+ this also applied to other users of core file tcpsrv.c, but imtcp was
+ by far the most prominent and widely-used, the rest rather exotic
+ (like imdiag)
+- added capability to specify substrings for field extraction mode
- added the "jsonf" property replacer option (and fieldname)
+- bugfix: omudpspoof did not work correctly if no spoof hostname was
+ configured
- bugfix: property replacer option "json" could lead to content loss
message was truncated if escaping was necessary
- bugfix: assigned ruleset was lost when using disk queues
@@ -9,6 +53,26 @@ Version 6.3.9 [DEVEL] 2012-04-??
stored inside the disk queue.
- bugfix/imuxsock: solving abort if hostname was not set; configured
hostname was not used (both merge regressions)
+ -bugfix/omfile: template action parameter was not accepted
+ (and template name set to "??" if the parameter was used)
+ Thanks to Brian Knox for alerting us on this bug.
+- bugfix: ommysql did not properly init/exit the mysql runtime library
+ this could lead to segfaults. Triggering condition: multiple action
+ instances using ommysql. Thanks to Tomas Heinrich for reporting this
+ problem and providing an initial patch (which my solution is based on,
+ I need to add more code to clean the mess up).
+- bugfix: rsyslog did not terminate when delayable inputs were blocked
+ due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre Lorbach
+ for helping to reproduce and fix it.
+- added capability to specify substrings for field extraction mode
+- bugfix: disk queue was not persisted on shutdown, regression of fix to
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ The new code also handles the case of shutdown of blocking light and
+ full delayable sources somewhat smarter and permits, assuming sufficient
+ timouts, to persist message up to the max queue capacity. Also some nits
+ in debug instrumentation have been fixed.
---------------------------------------------------------------------------
Version 6.3.8 [DEVEL] 2012-04-16
- added $PStatJSON directive to permit stats records in JSON format
@@ -137,7 +201,39 @@ Version 6.3.0 [DEVEL] (rgerhards), 2011-06-01
- introduced new config system
http://blog.gerhards.net/2011/06/new-rsyslog-config-system-materializes.html
---------------------------------------------------------------------------
-Version 6.2.1 [v6-stable], 2012-01-??
+Version 6.2.2 [v6-stable], 2012-06-13
+- build system improvements and spec file templates
+ Thanks to Abby Edwards for providing these enhancements
+- bugfix: disk queue was not persisted on shutdown, regression of fix to
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ The new code also handles the case of shutdown of blocking light and
+ full delayable sources somewhat smarter and permits, assuming sufficient
+ timouts, to persist message up to the max queue capacity. Also some nits
+ in debug instrumentation have been fixed.
+- bugfix: --enable-smcustbindcdr configure directive did not work
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=330
+ Thanks to Ultrabug for the patch.
+- add small delay (50ms) after sending shutdown message
+ There seem to be cases where the shutdown message is otherwise not
+ processed, not even on an idle system. Thanks to Marcin for
+ bringing this problem up.
+- support for resolving huge groups
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=310
+ Thanks to Alec Warner for the patch
+- bugfix: potential hang due to mutex deadlock
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=316
+ Thanks to Andreas Piesk for reporting&analyzing this bug as well as
+ providing patches and other help in resolving it.
+- bugfix: property PROCID empty instead of proper nilvalue if not present
+ If it is not present, it must have the nilvalue "-" as of RFC5424
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=332
+ Thanks to John N for reporting this issue.
+- bugfix: did not compile under solaris due to $uptime property code
+ For the time being, $uptime is not supported on Solaris
+- bugfix: "last message repeated n times" message was missing hostname
+ Thanks to Zdenek Salvet for finding this bug and to Bodik for reporting
+---------------------------------------------------------------------------
+Version 6.2.1 [v6-stable], 2012-05-10
- change plugin config interface to be compatible with pre-v6.2 system
The functionality was already removed (because it is superseeded by the
v6.3+ config language), but code was still present. I have now removed
@@ -153,6 +249,17 @@ Version 6.2.1 [v6-stable], 2012-01-??
- bugfix: stopped DA queue was never processed after a restart due to a
regression from statistics module
- bugfix: memory leak in array passing output module mode
+- bugfix: ommysql did not properly init/exit the mysql runtime library
+ this could lead to segfaults. Triggering condition: multiple action
+ instances using ommysql. Thanks to Tomas Heinrich for reporting this
+ problem and providing an initial patch (which my solution is based on,
+ I need to add more code to clean the mess up).
+- bugfix: rsyslog did not terminate when delayable inputs were blocked
+ due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre Lorbach
+ for helping to reproduce and fix it.
+- bugfix/tcpflood: sending small test files did not work correctly
---------------------------------------------------------------------------
Version 6.2.0 [v6-stable], 2012-01-09
- bugfix (kind of): removed numerical part from pri-text
@@ -396,6 +503,50 @@ expected that interfaces, even new ones, break during the initial
syslog plain tcp input plugin (NOT supporting TLS!)
[ported from v4]
---------------------------------------------------------------------------
+Version 5.9.8 [V5-BETA], 2012-05-??
+- bugfix: delayble source could block action queue, even if there was
+ a disk queue associated with it. The root cause of this problem was
+ that it makes no sense to delay messages once they arrive in the
+ action queue - the "input" that is being held in that case is the main
+ queue worker, what makes no sense.
+ Thanks to Marcin for alerting us on this problem and providing
+ instructions to reproduce it.
+- bugfix: disk queue was not persisted on shutdown, regression of fix to
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ The new code also handles the case of shutdown of blocking light and
+ full delayable sources somewhat smarter and permits, assuming sufficient
+ timouts, to persist message up to the max queue capacity. Also some nits
+ in debug instrumentation have been fixed.
+- add small delay (50ms) after sending shutdown message
+ There seem to be cases where the shutdown message is otherwise not
+ processed, not even on an idle system. Thanks to Marcin for
+ bringing this problem up.
+- support for resolving huge groups
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=310
+ Thanks to Alec Warner for the patch
+- bugfix: potential hang due to mutex deadlock
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=316
+ Thanks to Andreas Piesk for reporting&analyzing this bug as well as
+ providing patches and other help in resolving it.
+- bugfix: property PROCID empty instead of proper nilvalue if not present
+ If it is not present, it must have the nilvalue "-" as of RFC5424
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=332
+ Thanks to John N for reporting this issue.
+---------------------------------------------------------------------------
+Version 5.9.7 [V5-BETA], 2012-05-10
+- added capability to specify substrings for field extraction mode
+- bugfix: ommysql did not properly init/exit the mysql runtime library
+ this could lead to segfaults. Triggering condition: multiple action
+ instances using ommysql. Thanks to Tomas Heinrich for reporting this
+ problem and providing an initial patch (which my solution is based on,
+ I need to add more code to clean the mess up).
+- bugfix: rsyslog did not terminate when delayable inputs were blocked
+ due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre Lorbach
+ for helping to reproduce and fix it.
+- bugfix/tcpflood: sending small test files did not work correctly
+---------------------------------------------------------------------------
Version 5.9.6 [V5-BETA], 2012-04-12
- added configuration directives to customize queue light delay marks
- permit size modifiers (k,m,g,...) in integer config parameters
@@ -531,7 +682,70 @@ Version 5.9.0 [V5-DEVEL] (rgerhards), 2011-06-08
affected directive was: $ActionExecOnlyWhenPreviousIsSuspended on
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=236
---------------------------------------------------------------------------
-Version 5.8.11 [V5-stable] 2012-04-??
+Version 5.8.13 [V5-stable] 2012-06-??
+- bugfix: "last message repeated n times" message was missing hostname
+ Thanks to Zdenek Salvet for finding this bug and to Bodik for reporting
+- bugfix "$PreserveFQDN on" was not honored in some modules
+ Thanks to bodik for reporting this bug.
+- bugfix: randomized IP option header in omudpspoof caused problems
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=327
+ Thanks to Rick Brown for helping to test out the patch.
+---------------------------------------------------------------------------
+Version 5.8.12 [V5-stable] 2012-06-06
+- add small delay (50ms) after sending shutdown message
+ There seem to be cases where the shutdown message is otherwise not
+ processed, not even on an idle system. Thanks to Marcin for
+ bringing this problem up.
+- support for resolving huge groups
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=310
+ Thanks to Alec Warner for the patch
+- bugfix: delayble source could block action queue, even if there was
+ a disk queue associated with it. The root cause of this problem was
+ that it makes no sense to delay messages once they arrive in the
+ action queue - the "input" that is being held in that case is the main
+ queue worker, what makes no sense.
+ Thanks to Marcin for alerting us on this problem and providing
+ instructions to reproduce it.
+- bugfix: disk queue was not persisted on shutdown, regression of fix to
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ The new code also handles the case of shutdown of blocking light and
+ full delayable sources somewhat smarter and permits, assuming sufficient
+ timouts, to persist message up to the max queue capacity. Also some nits
+ in debug instrumentation have been fixed.
+- bugfix/omudpspoof: problems, including abort, happend when run on
+ multiple threads. Root cause is that libnet is not thread-safe.
+ omudpspoof now guards libnet calls with their own mutex.
+- bugfix: if debug message could end up in log file when forking
+ if rsyslog was set to auto-background (thus fork, the default) and debug
+ mode to stdout was enabled, debug messages ended up in the first log file
+ opened. Currently, stdout logging is completely disabled in forking mode
+ (but writing to the debug log file is still possible). This is a change
+ in behaviour, which is under review. If it causes problems to you,
+ please let us know.
+ Thanks to Tomas Heinrich for the patch.
+- bugfix/tcpflood: sending small test files did not work correctly
+- bugfix: potential hang due to mutex deadlock
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=316
+ Thanks to Andreas Piesk for reporting&analyzing this bug as well as
+ providing patches and other help in resolving it.
+- bugfix: property PROCID empty instead of proper nilvalue if not present
+ If it is not present, it must have the nilvalue "-" as of RFC5424
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=332
+ Thanks to John N for reporting this issue.
+---------------------------------------------------------------------------
+Version 5.8.11 [V5-stable] 2012-05-03
+- bugfix: ommysql did not properly init/exit the mysql runtime library
+ this could lead to segfaults. Triggering condition: multiple action
+ instances using ommysql. Thanks to Tomas Heinrich for reporting this
+ problem and providing an initial patch (which my solution is based on,
+ I need to add more code to clean the mess up).
+- bugfix: rsyslog did not terminate when delayable inputs were blocked
+ due to unvailable sources. Fixes:
+ http://bugzilla.adiscon.com/show_bug.cgi?id=299
+ Thanks to Marcin M for bringing up this problem and Andre Lorbach
+ for helping to reproduce and fix it.
+- bugfix: active input in "light delay state" could block rsyslog
+ termination, at least for prolonged period of time
- bugfix: imptcp input name could not be set
config directive was accepted, but had no effect
- bugfix: assigned ruleset was lost when using disk queues
@@ -541,6 +755,10 @@ Version 5.8.11 [V5-stable] 2012-04-??
- bugfix: hostname was not requeried on HUP
Thanks to Per Jessen for reporting this bug and Marius Tomaschewski for
his help in testing the fix.
+- bugfix: inside queue.c, some thread cancel states were not correctly
+ reset. While this is a bug, we assume it did have no practical effect
+ because the reset as it was done was set to the state the code actually
+ had at this point. But better fix this...
---------------------------------------------------------------------------
Version 5.8.10 [V5-stable] 2012-04-05
- bugfix: segfault on startup if $actionqueuefilename was missing for disk
diff --git a/Makefile.am b/Makefile.am
index 999404e7..befc1d44 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,8 @@
sbin_PROGRAMS =
pkglib_LTLIBRARIES =
+pkgconfigdir = $(libdir)/pkgconfig
+
if ENABLE_INET
pkglib_LTLIBRARIES += lmtcpsrv.la lmtcpclt.la
#
diff --git a/action.c b/action.c
index f999ec9d..f33fece9 100644
--- a/action.c
+++ b/action.c
@@ -327,10 +327,6 @@ rsRetVal actionConstruct(action_t **ppThis)
ASSERT(ppThis != NULL);
- if(cs.pszActionName != NULL) {
- free(cs.pszActionName);
- cs.pszActionName = NULL;
- }
CHKmalloc(pThis = (action_t*) calloc(1, sizeof(action_t)));
pThis->iResumeInterval = 30;
pThis->iResumeRetryCount = 0;
@@ -1351,7 +1347,7 @@ doSubmitToActionQ(action_t *pAction, msg_t *pMsg)
if(pAction->pQueue->qType == QUEUETYPE_DIRECT)
iRet = qqueueEnqObjDirect(pAction->pQueue, (void*) MsgAddRef(pMsg));
else
- iRet = qqueueEnqObj(pAction->pQueue, pMsg->flowCtlType, (void*) MsgAddRef(pMsg));
+ iRet = qqueueEnqObj(pAction->pQueue, eFLOWCTL_NO_DELAY, (void*) MsgAddRef(pMsg));
RETiRet;
}
@@ -2015,34 +2011,6 @@ initConfigVariables(void)
}
-/* save our config and create a new scope. Note that things are messed up if
- * this is called while the config is already saved (we currently do not
- * have a stack as the design is we need none!
- * rgerhards, 2010-07-23
- */
-rsRetVal
-actionNewScope(void)
-{
- DEFiRet;
- memcpy(&cs_save, &cs, sizeof(cs));
- initConfigVariables();
- RETiRet;
-}
-
-
-/* restore previously saved scope.
- * rgerhards, 2010-07-23
- */
-rsRetVal
-actionRestoreScope(void)
-{
- DEFiRet;
- memcpy(&cs, &cs_save, sizeof(cs));
- RETiRet;
-}
-
-
-
rsRetVal
actionNewInst(struct nvlst *lst, action_t **ppAction)
{
diff --git a/action.h b/action.h
index 4da0be24..5f142b00 100644
--- a/action.h
+++ b/action.h
@@ -107,8 +107,6 @@ rsRetVal actionWriteToAction(action_t *pAction);
rsRetVal actionCallHUPHdlr(action_t *pAction);
rsRetVal actionClassInit(void);
rsRetVal addAction(action_t **ppAction, modInfo_t *pMod, void *pModData, omodStringRequest_t *pOMSR, struct cnfparamvals *actParams, struct cnfparamvals *queueParams, int bSuspended);
-rsRetVal actionNewScope(void);
-rsRetVal actionRestoreScope(void);
rsRetVal activateActions(void);
rsRetVal actionNewInst(struct nvlst *lst, action_t **ppAction);
diff --git a/build/rhel/README b/build/rhel/README
new file mode 100644
index 00000000..4c4ead76
--- /dev/null
+++ b/build/rhel/README
@@ -0,0 +1,17 @@
+This directory contains a series of spec files to help build rsyslog
+and its dependencies on a RHEL 5 or 6 (or compatible variant) system.
+
+Build order:
+(dependencies for rsyslog's mmnormalize)
+1. libestr
+2. libee
+3. liblognorm
+
+(dependency for rsyslog)
+4. librelp
+
+(external dependencies for zmq modules)
+5. zeromq
+6. czmq
+
+7. rsyslog
diff --git a/build/rhel/dependencies/czmq.spec b/build/rhel/dependencies/czmq.spec
new file mode 100644
index 00000000..9f0ff908
--- /dev/null
+++ b/build/rhel/dependencies/czmq.spec
@@ -0,0 +1,107 @@
+Name: czmq
+Version: 1.2.0
+Release: 1%{?dist}
+Summary: High-level C binding for 0MQ (ZeroMQ).
+
+Group: Development/Libraries
+License: LGPL
+URL: http://czmq.zeromq.org/
+Source0: %{name}-%{version}.tar.gz
+BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
+
+BuildRequires: zeromq-devel
+BuildRequires: xmlto, xmltoman
+BuildRequires: asciidoc
+Requires: zeromq
+Requires(post): /sbin/ldconfig
+
+%if %{?rhel}%{!?rhel:0} >= 6
+BuildRequires: libuuid-devel
+Requires: libuuid
+%elseif %{?rhel}%{!?rhel:0} >= 5
+BuildRequires: e2fsprogs-devel
+Requires: e2fsprogs
+%else
+BuildRequires: uuid-devel
+Requires: uuid
+%endif
+
+%description
+%{summary}
+
+%package devel
+Summary: Development bindings for 0MQ (ZeroMQ).
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: pkgconfig
+
+%description devel
+Development bindings for 0MQ (ZeroMQ).
+
+%prep
+%setup -q
+
+%build
+export CFLAGS="-Wno-unused-variable"
+%configure
+make %{?_smp_mflags}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make install DESTDIR=$RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(0644,root,root,0755)
+%doc AUTHORS COPYING* INSTALL README NEWS
+
+%{_mandir}/man7/zloop.7.gz
+%{_mandir}/man7/zsockopt.7.gz
+%{_mandir}/man7/zhash.7.gz
+%{_mandir}/man7/zctx.7.gz
+%{_mandir}/man7/zsocket.7.gz
+%{_mandir}/man7/zframe.7.gz
+%{_mandir}/man7/zfile.7.gz
+%{_mandir}/man7/zthread.7.gz
+%{_mandir}/man7/czmq.7.gz
+%{_mandir}/man7/zstr.7.gz
+%{_mandir}/man7/zclock.7.gz
+%{_mandir}/man7/zmsg.7.gz
+%{_mandir}/man7/zlist.7.gz
+%{_libdir}/libczmq.so*
+%attr(0755,root,root) %{_bindir}/czmq_selftest
+
+%files devel
+%defattr(0644,root,root,0755)
+%{_libdir}/libczmq.la
+%{_libdir}/pkgconfig/libczmq.pc
+%{_libdir}/libczmq.a
+%{_includedir}/zsocket.h
+%{_includedir}/czmq.h
+%{_includedir}/zstr.h
+%{_includedir}/zlist.h
+%{_includedir}/zsockopt.h
+%{_includedir}/zmsg.h
+%{_includedir}/zclock.h
+%{_includedir}/zthread.h
+%{_includedir}/zloop.h
+%{_includedir}/zframe.h
+%{_includedir}/czmq_prelude.h
+%{_includedir}/zhash.h
+%{_includedir}/zctx.h
+%{_includedir}/zfile.h
+
+%changelog
+
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 1.2.0-1
+- updated to 1.2.0, split devel package out
+- updated CFLAGS to be compatible with gcc 4+
+
+* Thu Sep 29 2011 Lars Kellogg-Stedman <lars@seas.harvard.edu> - 1.1.0-1
+- initial package build
+
diff --git a/build/rhel/dependencies/zeromq.spec b/build/rhel/dependencies/zeromq.spec
new file mode 100644
index 00000000..d1aa5f4c
--- /dev/null
+++ b/build/rhel/dependencies/zeromq.spec
@@ -0,0 +1,142 @@
+Name: zeromq
+Version: 2.2.0
+Release: 1%{?dist}
+Summary: The ZeroMQ messaging library
+Group: Applications/Internet
+License: LGPLv3+
+URL: http://www.zeromq.org/
+Source: http://download.zeromq.org/%{name}-%{version}.tar.gz
+Prefix: %{_prefix}
+Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
+BuildRequires: gcc, make, gcc-c++, libstdc++-devel
+Requires: libstdc++
+
+%if %{?rhel}%{!?rhel:0} >= 6
+BuildRequires: libuuid-devel
+Requires: libuuid
+%elseif %{?rhel}%{!?rhel:0} >= 5
+BuildRequires: e2fsprogs-devel
+Requires: e2fsprogs
+%else
+BuildRequires: uuid-devel
+Requires: uuid
+%endif
+
+# Build pgm only on supported archs
+%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
+BuildRequires: glib2-devel
+Requires: glib2
+%endif
+
+%description
+The 0MQ lightweight messaging kernel is a library which extends the
+standard socket interfaces with features traditionally provided by
+specialised messaging middleware products. 0MQ sockets provide an
+abstraction of asynchronous message queues, multiple messaging
+patterns, message filtering (subscriptions), seamless access to
+multiple transport protocols and more.
+
+This package contains the ZeroMQ shared library.
+
+%package devel
+Summary: Development files and static library for the ZeroMQ library
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}, pkgconfig
+
+%description devel
+The 0MQ lightweight messaging kernel is a library which extends the
+standard socket interfaces with features traditionally provided by
+specialised messaging middleware products. 0MQ sockets provide an
+abstraction of asynchronous message queues, multiple messaging
+patterns, message filtering (subscriptions), seamless access to
+multiple transport protocols and more.
+
+This package contains ZeroMQ related development libraries and header files.
+
+%prep
+%setup -q
+
+%build
+%ifarch pentium3 pentium4 athlon i386 i486 i586 i686 x86_64
+ %configure --with-pgm
+%else
+ %configure
+%endif
+
+%{__make} %{?_smp_mflags}
+
+%install
+[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
+
+# Install the package to build area
+%{__make} check
+%makeinstall
+
+%post
+/sbin/ldconfig
+
+%postun
+/sbin/ldconfig
+
+%clean
+[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+
+# docs in the main package
+%doc AUTHORS ChangeLog COPYING COPYING.LESSER NEWS README
+
+# libraries
+%{_libdir}/libzmq.so.1
+%{_libdir}/libzmq.so.1.0.1
+
+%{_mandir}/man7/zmq.7.gz
+
+%files devel
+%defattr(-,root,root,-)
+%{_includedir}/zmq.h
+%{_includedir}/zmq.hpp
+%{_includedir}/zmq_utils.h
+
+%{_libdir}/libzmq.la
+%{_libdir}/libzmq.a
+%{_libdir}/pkgconfig/libzmq.pc
+%{_libdir}/libzmq.so
+
+%{_mandir}/man3/zmq_bind.3.gz
+%{_mandir}/man3/zmq_close.3.gz
+%{_mandir}/man3/zmq_connect.3.gz
+%{_mandir}/man3/zmq_errno.3.gz
+%{_mandir}/man3/zmq_device.3.gz
+%{_mandir}/man3/zmq_getsockopt.3.gz
+%{_mandir}/man3/zmq_init.3.gz
+%{_mandir}/man3/zmq_msg_close.3.gz
+%{_mandir}/man3/zmq_msg_copy.3.gz
+%{_mandir}/man3/zmq_msg_data.3.gz
+%{_mandir}/man3/zmq_msg_init.3.gz
+%{_mandir}/man3/zmq_msg_init_data.3.gz
+%{_mandir}/man3/zmq_msg_init_size.3.gz
+%{_mandir}/man3/zmq_msg_move.3.gz
+%{_mandir}/man3/zmq_msg_size.3.gz
+%{_mandir}/man3/zmq_poll.3.gz
+%{_mandir}/man3/zmq_recv.3.gz
+%{_mandir}/man3/zmq_send.3.gz
+%{_mandir}/man3/zmq_setsockopt.3.gz
+%{_mandir}/man3/zmq_socket.3.gz
+%{_mandir}/man3/zmq_strerror.3.gz
+%{_mandir}/man3/zmq_term.3.gz
+%{_mandir}/man3/zmq_version.3.gz
+%{_mandir}/man7/zmq_cpp.7.gz
+%{_mandir}/man7/zmq_epgm.7.gz
+%{_mandir}/man7/zmq_inproc.7.gz
+%{_mandir}/man7/zmq_ipc.7.gz
+%{_mandir}/man7/zmq_pgm.7.gz
+%{_mandir}/man7/zmq_tcp.7.gz
+
+%changelog
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 2.2.0-1
+- updated version
+
+* Sat Apr 10 2010 Mikko Koppanen <mkoppanen@php.net> 2.0.7-1
+- Initial packaging
diff --git a/build/rhel/libee/libee.spec b/build/rhel/libee/libee.spec
new file mode 100644
index 00000000..8bb3a378
--- /dev/null
+++ b/build/rhel/libee/libee.spec
@@ -0,0 +1,90 @@
+Summary: libee - an event expression library inspired by CEE
+Name: libee
+Version: 0.4.1
+Release: 1%{?dist}
+License: GPL
+Group: Networking/Admin
+Source: %{name}-%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-build
+BuildRequires: libestr-devel
+Requires: /sbin/ldconfig
+
+%description
+CEE is an upcoming standard used to describe network events in a number of
+normalized formats. It's goal is to unify they currently many different
+representations that exist in the industry.
+
+The core idea of libee is to provide a small but hopefully convenient API layer
+above the CEE standard. However, CEE is not finished. At the time of this writing,
+CEE is under heavy development and even some of its core data structures (like
+the data dictionary and taxonmy) have not been fully specified.
+
+libee should be thought of as a useful library that helps you get your events
+normalized. If you program cleanly to libee, chances are not bad that only
+relatively little effort is required to move your app over to be CEE compliant
+(once the standard is out).
+
+%package devel
+Summary: include files for libee
+Group: Networking/Admin
+Requires: %name = %version-%release
+Requires: /usr/bin/pkg-config
+
+%description devel
+This package provides include files and pkg-config settings for libee.
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure CFLAGS="%{optflags}" --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libee.so
+%{_libdir}/libee.so.0
+%{_libdir}/libee.so.0.0.0
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/pkgconfig/libee.pc
+%{_includedir}/libee/apache.h
+%{_includedir}/libee/ctx.h
+%{_includedir}/libee/event.h
+%{_includedir}/libee/field.h
+%{_includedir}/libee/fieldbucket.h
+%{_includedir}/libee/fieldset.h
+%{_includedir}/libee/fieldtype.h
+%{_includedir}/libee/int.h
+%{_includedir}/libee/internal.h
+%{_includedir}/libee/libee.h
+%{_includedir}/libee/namelist.h
+%{_includedir}/libee/obj.h
+%{_includedir}/libee/parser.h
+%{_includedir}/libee/primitivetype.h
+%{_includedir}/libee/tag.h
+%{_includedir}/libee/tagbucket.h
+%{_includedir}/libee/tagset.h
+%{_includedir}/libee/timestamp.h
+%{_includedir}/libee/valnode.h
+%{_includedir}/libee/value.h
+%{_includedir}/libee/valuetype.h
+%{_sbindir}/libee-convert
+%{_libdir}/libee.a
+%{_libdir}/libee.la
+
+%changelog
+
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 0.4.1-1
+- initial version, used to build latest git master
diff --git a/build/rhel/libestr/libestr.spec b/build/rhel/libestr/libestr.spec
new file mode 100644
index 00000000..10589d88
--- /dev/null
+++ b/build/rhel/libestr/libestr.spec
@@ -0,0 +1,56 @@
+Summary: libestr - some essentials for string handling (and a bit more)
+Name: libestr
+Version: 0.1.2
+Release: 1%{?dist}
+License: GPL
+Group: Networking/Admin
+Source: %{name}-%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-build
+Requires: /sbin/ldconfig
+
+%description
+libestr is a string handling library used in rsyslog.
+
+%package devel
+Summary: includes for compilation against libestr
+Group: Networking/Admin
+Requires: %name = %version-%release
+Requires: /usr/bin/pkg-config
+
+%description devel
+This package provides the include files and pkg-config information for
+compiling against libestr.
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure CFLAGS="%{optflags}" --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libestr.so
+%{_libdir}/libestr.so.0
+%{_libdir}/libestr.so.0.0.0
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/libestr.h
+%{_libdir}/pkgconfig/libestr.pc
+%{_libdir}/libestr.a
+%{_libdir}/libestr.la
+
+%changelog
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 0.1.2-1
+- initial version, used to build latest git master
diff --git a/build/rhel/liblognorm/liblognorm.spec b/build/rhel/liblognorm/liblognorm.spec
new file mode 100644
index 00000000..2047525e
--- /dev/null
+++ b/build/rhel/liblognorm/liblognorm.spec
@@ -0,0 +1,70 @@
+Summary: liblognorm - a tool to normalize log data
+Name: liblognorm
+Version: 0.3.4
+Release: 1%{?dist}
+License: GPL
+Group: Networking/Admin
+Source: %{name}-%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-build
+BuildRequires: libestr-devel, libee-devel
+Requires: /sbin/ldconfig
+
+%description
+Briefly described, liblognorm is a tool to normalize log data.
+
+People who need to take a look at logs often have a common problem. Logs from
+different machines (from different vendors) usually have different formats for
+their logs. Even if it is the same type of log (e.g. from firewalls), the log
+entries are so different, that it is pretty hard to read these. This is where
+liblognorm comes into the game. With this tool you can normalize all your logs.
+All you need is liblognorm and its dependencies and a sample database that fits
+the logs you want to normalize.
+
+%package devel
+Summary: includes for compiling against liblognorm
+Group: Networking/Admin
+Requires: %name = %version-%release
+Requires: /usr/bin/pkg-config
+
+%description devel
+This package provides the include and pkg-config files for compiling
+against liblognorm.
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure CFLAGS="%{optflags}" --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/liblognorm.so
+%{_libdir}/liblognorm.so.0
+%{_libdir}/liblognorm.so.0.0.0
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/pkgconfig/lognorm.pc
+%{_includedir}/annot.h
+%{_includedir}/liblognorm.h
+%{_includedir}/lognorm.h
+%{_includedir}/ptree.h
+%{_includedir}/samp.h
+%{_bindir}/normalizer
+%{_libdir}/liblognorm.a
+%{_libdir}/liblognorm.la
+
+%changelog
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 0.3.4-1
+- initial version, used to build latest git master
diff --git a/build/rhel/librelp/librelp.spec b/build/rhel/librelp/librelp.spec
new file mode 100644
index 00000000..04f78dc0
--- /dev/null
+++ b/build/rhel/librelp/librelp.spec
@@ -0,0 +1,65 @@
+Summary: librelp - a reliable logging library
+Name: librelp
+Version: 1.0.1
+Release: 1%{?dist}
+License: GPL
+Group: Networking/Admin
+Source: %{name}-%{version}.tar.gz
+BuildRoot: /var/tmp/%{name}-build
+Requires: /sbin/ldconfig
+
+%description
+librelp is an easy to use library for the RELP protocol. RELP in turn provides reliable
+event logging over the network (and consequently RELP stands for Reliable Event Logging
+Protocol). RELP was initiated by Rainer Gerhards after he was finally upset by the lossy
+nature of plain tcp syslog and wanted a cure for all these dangling issues.
+
+RELP (and hence) librelp assures that no message is lost, not even when connections
+break and a peer becomes unavailable. The current version of RELP has a minimal window
+of opportunity for message duplication after a session has been broken due to network
+problems. In this case, a few messages may be duplicated (a problem that also exists
+with plain tcp syslog). Future versions of RELP will address this shortcoming.
+
+%package devel
+Summary: includes for compilation against librelp
+Group: Networking/Admin
+Requires: %name = %version-%release
+Requires: /usr/bin/pkg-config
+
+%description devel
+This package provides include and pkg-config files for compiling against
+librelp.
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+%configure CFLAGS="%{optflags}" --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir}
+%{__make}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+%post
+/sbin/ldconfig
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/librelp.so.0.0.0
+%{_libdir}/librelp.so.0
+%{_libdir}/librelp.so
+
+%files devel
+%defattr(644,root,root,755)
+%{_includedir}/librelp.h
+%{_libdir}/pkgconfig/relp.pc
+%{_libdir}/librelp.a
+%{_libdir}/librelp.la
+
+%changelog
+* Tue Jun 12 2012 Abby Edwards <abby.lina.edwards@gmail.com> 1.0.1-1
+- initial version, used to build latest git master
diff --git a/build/rhel/rsyslog/rsyslog.conf b/build/rhel/rsyslog/rsyslog.conf
new file mode 100644
index 00000000..36cea98f
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.conf
@@ -0,0 +1,80 @@
+# rsyslog v5 configuration file
+
+# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
+# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
+
+#### MODULES ####
+
+$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
+$ModLoad imklog # provides kernel logging support (previously done by rklogd)
+#$ModLoad immark # provides --MARK-- message capability
+
+# Provides UDP syslog reception
+#$ModLoad imudp
+#$UDPServerRun 514
+
+# Provides TCP syslog reception
+#$ModLoad imtcp
+#$InputTCPServerRun 514
+
+
+#### GLOBAL DIRECTIVES ####
+
+# Use default timestamp format
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+
+# File syncing capability is disabled by default. This feature is usually not required,
+# not useful and an extreme performance hit
+#$ActionFileEnableSync on
+
+# Include all config files in /etc/rsyslog.d/
+$IncludeConfig /etc/rsyslog.d/*.conf
+
+
+#### RULES ####
+
+# Log all kernel messages to the console.
+# Logging much else clutters up the screen.
+#kern.* /dev/console
+
+# Log anything (except mail) of level info or higher.
+# Don't log private authentication messages!
+*.info;mail.none;authpriv.none;cron.none /var/log/messages
+
+# The authpriv file has restricted access.
+authpriv.* /var/log/secure
+
+# Log all the mail messages in one place.
+mail.* -/var/log/maillog
+
+
+# Log cron stuff
+cron.* /var/log/cron
+
+# Everybody gets emergency messages
+*.emerg *
+
+# Save news errors of level crit and higher in a special file.
+uucp,news.crit /var/log/spooler
+
+# Save boot messages also to boot.log
+local7.* /var/log/boot.log
+
+
+# ### begin forwarding rule ###
+# The statement between the begin ... end define a SINGLE forwarding
+# rule. They belong together, do NOT split them. If you create multiple
+# forwarding rules, duplicate the whole block!
+# Remote Logging (we use TCP for reliable delivery)
+#
+# An on-disk queue is created for this action. If the remote host is
+# down, messages are spooled to disk and sent when it is up again.
+#$WorkDirectory /var/lib/rsyslog # where to place spool files
+#$ActionQueueFileName fwdRule1 # unique name prefix for spool files
+#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
+#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
+#$ActionQueueType LinkedList # run asynchronously
+#$ActionResumeRetryCount -1 # infinite retries if host is down
+# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
+#*.* @@remote-host:514
+# ### end of the forwarding rule ###
diff --git a/build/rhel/rsyslog/rsyslog.init b/build/rhel/rsyslog/rsyslog.init
new file mode 100644
index 00000000..ed4b1b1f
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.init
@@ -0,0 +1,121 @@
+#!/bin/bash
+#
+# rsyslog Startup script for rsyslog.
+#
+# chkconfig: 2345 12 88
+# description: Syslog is the facility by which many daemons use to log \
+# messages to various system log files. It is a good idea to always \
+# run rsyslog.
+### BEGIN INIT INFO
+# Provides: $syslog
+# Required-Start: $local_fs
+# Required-Stop: $local_fs
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Enhanced system logging and kernel message trapping daemons
+# Description: Rsyslog is an enhanced multi-threaded syslogd supporting,
+# among others, MySQL, syslog/tcp, RFC 3195, permitted
+# sender lists, filtering on any message part, and fine
+# grain output format control.
+### END INIT INFO
+
+# Source function library.
+. /etc/init.d/functions
+
+RETVAL=0
+PIDFILE=/var/run/syslogd.pid
+
+prog=rsyslog
+exec=/sbin/rsyslogd
+lockfile=/var/lock/subsys/$prog
+
+# Source config
+if [ -f /etc/sysconfig/$prog ] ; then
+ . /etc/sysconfig/$prog
+fi
+
+start() {
+ [ -x $exec ] || exit 5
+
+ umask 077
+
+ syntaxcheck
+
+ RETVAL=$?
+ if [ $RETVAL -ne 0 ] ; then
+ echo "Refusing to start system logger due to syntax errors; correct to continue."
+ return $RETVAL
+ fi
+
+ echo -n $"Starting rsyslog: "
+ daemon --pidfile="${PIDFILE}" $exec -i "${PIDFILE}" $SYSLOGD_OPTIONS
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && touch $lockfile
+ return $RETVAL
+}
+stop() {
+ echo -n $"Shutting down system logger: "
+ killproc -p "${PIDFILE}" $exec
+ RETVAL=$?
+ echo
+ [ $RETVAL -eq 0 ] && rm -f $lockfile
+ return $RETVAL
+}
+rhstatus() {
+ status -p "${PIDFILE}" -l $prog $exec
+}
+restart() {
+ stop
+ start
+}
+
+syntaxcheck() {
+ [ -x $exec ] || exit 5
+
+ echo "Checking rsyslog configuration syntax: "
+ $exec $SYSLOGD_OPTIONS -n -N1
+ echo
+
+ RETVAL=$?
+
+ if [ $RETVAL -eq 0 ] ; then
+ echo "syntax is okay"
+ else
+ echo "configuration has syntax errors"
+ fi
+ return $RETVAL
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ reload)
+ exit 3
+ ;;
+ force-reload)
+ restart
+ ;;
+ status)
+ rhstatus
+ ;;
+ condrestart|try-restart)
+ rhstatus >/dev/null 2>&1 || exit 0
+ restart
+ ;;
+ syntaxcheck)
+ syntaxcheck
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|condrestart|try-restart|reload|force-reload|status}"
+ exit 3
+esac
+
+exit $?
diff --git a/build/rhel/rsyslog/rsyslog.log b/build/rhel/rsyslog/rsyslog.log
new file mode 100644
index 00000000..0e3fc160
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.log
@@ -0,0 +1,8 @@
+/var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler
+{
+ missingok
+ sharedscripts
+ postrotate
+ /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
+ endscript
+}
diff --git a/build/rhel/rsyslog/rsyslog.spec b/build/rhel/rsyslog/rsyslog.spec
new file mode 100644
index 00000000..4aa91df3
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.spec
@@ -0,0 +1,786 @@
+%global _exec_prefix %{nil}
+%global _libdir %{_exec_prefix}/%{_lib}
+%define rsyslog_statedir %{_sharedstatedir}/rsyslog
+%define rsyslog_pkidir %{_sysconfdir}/pki/rsyslog
+
+Summary: Enhanced system logging and kernel message trapping daemon
+Name: rsyslog
+Version: 6.5.0
+Release: 1%{?dist}
+License: (GPLv3+ and ASL 2.0)
+Group: System Environment/Daemons
+URL: http://www.rsyslog.com/
+Source0: %{name}-%{version}.tar.gz
+Source1: rsyslog.init
+Source2: rsyslog.conf
+Source3: rsyslog.sysconfig
+Source4: rsyslog.log
+
+BuildRequires: zlib-devel
+BuildRequires: pkgconfig
+BuildRequires: flex
+BuildRequires: bison
+
+%if %{?rhel}%{!?rhel:0} >= 6
+BuildRequires: libcurl-devel
+Requires: libcurl
+%elseif %{?rhel}%{!?rhel:0} >= 5
+BuildRequires: curl-devel
+Requires: curl
+%endif
+
+Requires: logrotate >= 3.5.2
+Requires: bash >= 2.0
+Requires(post): /sbin/chkconfig coreutils
+Requires(post): /sbin/service
+Requires(preun): /sbin/chkconfig
+Requires(preun): /sbin/service
+Requires(postun): /sbin/service
+
+Provides: syslog
+Obsoletes: sysklogd < 1.5-11
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+%package elasticsearch
+Summary: ElasticSearch output module for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+
+%package mmjsonparse
+Summary: JSON enhanced logging support
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+
+%package mmnormalize
+Summary: Log normalization support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: libestr-devel libee-devel liblognorm-devel
+
+%package imzmq3
+Summary: ZMQ input module support
+Group: Systems Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: czmq-devel
+BuildRequires: zeromq-devel
+%if %{?rhel}%{!?rhel:0} >= 6
+BuildRequires: libuuid-devel
+Requires: libuuid
+%elseif %{?rhel}%{!?rhel:0} >= 5
+BuildRequires: e2fsprogs-devel
+Requires: e2fsprogs
+%else
+BuildRequires: uuid-devel
+Requires: uuid
+%endif
+
+
+%package omzmq3
+Summary: ZMQ output module support
+Group: Systems Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: czmq-devel
+BuildRequires: zeromq-devel
+%if %{?rhel}%{!?rhel:0} >= 6
+BuildRequires: libuuid-devel
+Requires: libuuid
+%elseif %{?rhel}%{!?rhel:0} >= 5
+BuildRequires: e2fsprogs-devel
+Requires: e2fsprogs
+%else
+BuildRequires: uuid-devel
+Requires: uuid
+%endif
+
+
+%package libdbi
+Summary: libdbi database support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: libdbi-devel
+
+%package mysql
+Summary: MySQL support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: mysql-devel >= 4.0
+
+%package pgsql
+Summary: PostgresSQL support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: postgresql-devel
+
+%package gssapi
+Summary: GSSAPI authentication and encryption support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: krb5-devel
+
+%package relp
+Summary: RELP protocol support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: librelp-devel
+
+%package gnutls
+Summary: TLS protocol support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: gnutls-devel
+
+%package snmp
+Summary: SNMP protocol support for rsyslog
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: net-snmp-devel
+
+%package udpspoof
+Summary: Provides the omudpspoof module
+Group: System Environment/Daemons
+Requires: %name = %version-%release
+BuildRequires: libnet-devel
+
+%description
+Rsyslog is an enhanced, multi-threaded syslog daemon. It supports MySQL,
+syslog/TCP, RFC 3195, permitted sender lists, filtering on any message part,
+and fine grain output format control. It is compatible with stock sysklogd
+and can be used as a drop-in replacement. Rsyslog is simple to set up, with
+advanced features suitable for enterprise-class, encryption-protected syslog
+relay chains.
+
+%description elasticsearch
+This module provides the capability for rsyslog to feed logs directly into
+Elasticsearch.
+
+%description mmjsonparse
+This module provides the capability to recognize and parse JSON enhanced
+syslog messages.
+
+%description mmnormalize
+This module provides the capability to normalize log messages via liblognorm.
+
+%description imzmq3
+This module provides the capability to use a zeromq socket for input.
+
+%description omzmq3
+This module provides the capability to use a zeromq socket for output.
+
+%description libdbi
+This module supports a large number of database systems via
+libdbi. Libdbi abstracts the database layer and provides drivers for
+many systems. Drivers are available via the libdbi-drivers project.
+
+%description mysql
+The rsyslog-mysql package contains a dynamic shared object that will add
+MySQL database support to rsyslog.
+
+%description pgsql
+The rsyslog-pgsql package contains a dynamic shared object that will add
+PostgreSQL database support to rsyslog.
+
+%description gssapi
+The rsyslog-gssapi package contains the rsyslog plugins which support GSSAPI
+authentication and secure connections. GSSAPI is commonly used for Kerberos
+authentication.
+
+%description relp
+The rsyslog-relp package contains the rsyslog plugins that provide
+the ability to receive syslog messages via the reliable RELP
+protocol.
+
+%description gnutls
+The rsyslog-gnutls package contains the rsyslog plugins that provide the
+ability to receive syslog messages via upcoming syslog-transport-tls
+IETF standard protocol.
+
+%description snmp
+The rsyslog-snmp package contains the rsyslog plugin that provides the
+ability to send syslog messages as SNMPv1 and SNMPv2c traps.
+
+%description udpspoof
+This module is similar to the regular UDP forwarder, but permits to
+spoof the sender address. Also, it enables to circle through a number
+of source ports.
+
+%prep
+%setup -q
+#%patch0 -p1
+#%patch1 -p1
+#%patch2 -p1
+#%patch3 -p1
+#%patch4 -p1
+#%patch5 -p1
+
+%build
+%ifarch sparc64
+#sparc64 need big PIE
+export CFLAGS="$RPM_OPT_FLAGS -fPIE -DSYSLOGD_PIDNAME=\\\"syslogd.pid\\\""
+export LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now"
+%else
+export CFLAGS="$RPM_OPT_FLAGS -fpie -DSYSLOGD_PIDNAME=\\\"syslogd.pid\\\""
+export LDFLAGS="-pie -Wl,-z,relro -Wl,-z,now"
+%endif
+export PKG_CONFIG=/usr/bin/pkg-config
+%configure --disable-static \
+ --disable-testbench \
+ --enable-elasticsearch \
+ --enable-mmjsonparse \
+ --enable-mmnormalize \
+ --enable-imzmq3 \
+ --enable-omzmq3 \
+ --enable-gnutls \
+ --enable-gssapi-krb5 \
+ --enable-imfile \
+ --enable-impstats \
+ --enable-imptcp \
+ --enable-libdbi \
+ --enable-mail \
+ --enable-mysql \
+ --enable-omprog \
+ --enable-omudpspoof \
+ --enable-omuxsock \
+ --enable-pgsql \
+ --enable-pmlastmsg \
+ --enable-relp \
+ --enable-snmp \
+ --enable-unlimited-select
+make
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+make install DESTDIR=$RPM_BUILD_ROOT
+
+install -d -m 755 $RPM_BUILD_ROOT%{_initrddir}
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
+install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/rsyslog.d
+install -d -m 700 $RPM_BUILD_ROOT%{rsyslog_statedir}
+install -d -m 700 $RPM_BUILD_ROOT%{rsyslog_pkidir}
+
+install -p -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_initrddir}/rsyslog
+install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/rsyslog.conf
+install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/rsyslog
+install -p -m 644 %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/syslog
+
+#get rid of *.la
+rm $RPM_BUILD_ROOT/%{_libdir}/rsyslog/*.la
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+for n in /var/log/{messages,secure,maillog,spooler}
+do
+ [ -f $n ] && continue
+ umask 066 && touch $n
+done
+if [ $1 -eq 1 ]; then
+ # On install (not upgrade), enable (but don't start)
+ /sbin/chkconfig --add rsyslog
+ /sbin/chkconfig rsyslog on
+fi
+
+%preun
+if [ $1 = 0 ]; then
+ # On uninstall (not upgrade), disable and stop the units
+ /sbin/chkconfig --del rsyslog >/dev/null 2>&1 || :
+ /sbin/service rsyslog stop >/dev/null 2>&1 || :
+fi
+
+%postun
+if [ $1 -ge 1 ] ; then
+ # On upgrade (not uninstall), optionally, restart the daemon
+ /sbin/service rsyslog restart >/dev/null 2>&1 || :
+fi
+
+%files
+%defattr(-,root,root,-)
+%doc AUTHORS COPYING* NEWS README ChangeLog doc/*html
+%dir %{_libdir}/rsyslog
+%{_libdir}/rsyslog/imfile.so
+%{_libdir}/rsyslog/imklog.so
+%{_libdir}/rsyslog/immark.so
+%{_libdir}/rsyslog/impstats.so
+%{_libdir}/rsyslog/imptcp.so
+%{_libdir}/rsyslog/imtcp.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/omtesting.so
+%{_libdir}/rsyslog/ommail.so
+%{_libdir}/rsyslog/omprog.so
+%{_libdir}/rsyslog/omruleset.so
+%{_libdir}/rsyslog/omuxsock.so
+%{_libdir}/rsyslog/pmlastmsg.so
+%{_initrddir}/rsyslog
+
+%config(noreplace) %{_sysconfdir}/rsyslog.conf
+%config(noreplace) %{_sysconfdir}/sysconfig/rsyslog
+%config(noreplace) %{_sysconfdir}/logrotate.d/syslog
+%dir %{_sysconfdir}/rsyslog.d
+%dir %{rsyslog_statedir}
+%dir %{rsyslog_pkidir}
+%{_sbindir}/rsyslogd
+%{_mandir}/*/*
+
+%attr(0755,root,root) %{_initrddir}/rsyslog
+
+%files elasticsearch
+%defattr(-,root,root)
+%{_libdir}/rsyslog/omelasticsearch.so
+
+%files mmjsonparse
+%defattr(-,root,root)
+%{_libdir}/rsyslog/mmjsonparse.so
+
+%files mmnormalize
+%defattr(-,root,root)
+%{_libdir}/rsyslog/mmnormalize.so
+
+%files imzmq3
+%defattr(-,root,root)
+%{_libdir}/rsyslog/imzmq3.so
+
+%files omzmq3
+%defattr(-,root,root)
+%{_libdir}/rsyslog/omzmq3.so
+
+%files libdbi
+%defattr(-,root,root)
+%{_libdir}/rsyslog/omlibdbi.so
+
+%files mysql
+%defattr(-,root,root)
+%doc plugins/ommysql/createDB.sql
+%{_libdir}/rsyslog/ommysql.so
+
+%files pgsql
+%defattr(-,root,root)
+%doc plugins/ompgsql/createDB.sql
+%{_libdir}/rsyslog/ompgsql.so
+
+%files gssapi
+%defattr(-,root,root)
+%{_libdir}/rsyslog/lmgssutil.so
+%{_libdir}/rsyslog/imgssapi.so
+%{_libdir}/rsyslog/omgssapi.so
+
+%files relp
+%defattr(-,root,root)
+%{_libdir}/rsyslog/imrelp.so
+%{_libdir}/rsyslog/omrelp.so
+
+%files gnutls
+%defattr(-,root,root)
+%{_libdir}/rsyslog/lmnsd_gtls.so
+
+%files snmp
+%defattr(-,root,root)
+%{_libdir}/rsyslog/omsnmp.so
+
+%files udpspoof
+%defattr(-,root,root)
+%{_libdir}/rsyslog/omudpspoof.so
+
+%changelog
+
+* Wed Jun 06 2012 Abigail Edwards <abby.lina.edwards@gmail.com> 6.5.0-1
+- convert Fedora spec into RHEL 6 spec, as far as init scripts are concerned
+- removed references to all Fedora specific patches, as they were mostly
+ version specific
+- added syntax check option to the init script, made a successful check
+ a prequisite to starting the daemon
+- added several "--enable-*" directives to configure to create as many
+ subpackages as possible; enduser will need to have requisite dependencies
+ installed, some of which I had to write separate specs for.
+
+* Wed May 23 2012 Tomas Heinrich <theinric@redhat.com> 5.8.11-1
+- upgrade to new upstream stable version 5.8.11
+- add impstats and imptcp modules
+- include new license text files
+- consider lock file in 'status' action
+- add patch to update information on debugging in the man page
+- add patch to prevent debug output to stdout after forking
+- add patch to support ssl certificates with domain names longer than 128 chars
+
+* Fri Mar 30 2012 Jon Ciesla <limburgher@gmail.com> 5.8.7-2
+- libnet rebuild.
+
+* Mon Jan 23 2012 Tomas Heinrich <theinric@redhat.com> 5.8.7-1
+- upgrade to new upstream version 5.8.7
+- change license from 'GPLv3+' to '(GPLv3+ and ASL 2.0)'
+ http://blog.gerhards.net/2012/01/rsyslog-licensing-update.html
+- use a specific version for obsoleting sysklogd
+- add patches for better sysklogd compatibility (taken from upstream)
+
+* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.8.6-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
+
+* Tue Oct 25 2011 Tomas Heinrich <theinric@redhat.com> 5.8.6-1
+- upgrade to new upstream version 5.8.6
+- obsolete sysklogd
+ Resolves: #748495
+
+* Tue Oct 11 2011 Tomas Heinrich <theinric@redhat.com> 5.8.5-3
+- modify logrotate configuration to omit boot.log
+ Resolves: #745093
+
+* Mon Sep 06 2011 Tomas Heinrich <theinric@redhat.com> 5.8.5-2
+- add systemd-units to BuildRequires for the _unitdir macro definition
+
+* Mon Sep 05 2011 Tomas Heinrich <theinric@redhat.com> 5.8.5-1
+- upgrade to new upstream version (CVE-2011-3200)
+
+* Fri Jul 22 2011 Tomas Heinrich <theinric@redhat.com> 5.8.2-3
+- move the SysV init script into a subpackage
+- Resolves: 697533
+
+* Mon Jul 11 2011 Tomas Heinrich <theinric@redhat.com> 5.8.2-2
+- rebuild for net-snmp-5.7 (soname bump in libnetsnmp)
+
+* Mon Jun 27 2011 Tomas Heinrich <theinric@redhat.com> 5.8.2-1
+- upgrade to new upstream version 5.8.2
+
+* Mon Jun 13 2011 Tomas Heinrich <theinric@redhat.com> 5.8.1-2
+- scriptlet correction
+- use macro in unit file's path
+
+* Fri May 20 2011 Tomas Heinrich <theinric@redhat.com> 5.8.1-1
+- upgrade to new upstream version
+- correct systemd scriptlets (#705829)
+
+* Mon May 16 2011 Bill Nottingham <notting@redhat.com> - 5.7.9-3
+- combine triggers (as rpm will only execute one) - fixes upgrades (#699198)
+
+* Tue Apr 05 2011 Tomas Heinrich <theinric@redhat.com> 5.7.10-1
+- upgrade to new upstream version 5.7.10
+
+* Wed Mar 23 2011 Dan Horák <dan@danny.cz> - 5.7.9-2
+- rebuilt for mysql 5.5.10 (soname bump in libmysqlclient)
+
+* Fri Mar 18 2011 Tomas Heinrich <theinric@redhat.com> 5.7.9-1
+- upgrade to new upstream version 5.7.9
+- enable compilation of several new modules,
+ create new subpackages for some of them
+- integrate changes from Lennart Poettering
+ to add support for systemd
+ - add rsyslog-5.7.9-systemd.patch to tweak the upstream
+ service file to honour configuration from /etc/sysconfig/rsyslog
+
+* Fri Mar 18 2011 Dennis Gilmore <dennis@ausil.us> - 5.6.2-3
+- sparc64 needs big PIE
+
+* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.6.2-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
+
+* Mon Dec 20 2010 Tomas Heinrich <theinric@redhat.com> 5.6.2-1
+- upgrade to new upstream stable version 5.6.2
+- drop rsyslog-5.5.7-remove_include.patch; applied upstream
+- provide omsnmp module
+- use correct name for lock file (#659398)
+- enable specification of the pid file (#579411)
+- init script adjustments
+
+* Wed Oct 06 2010 Tomas Heinrich <theinric@redhat.com> 5.5.7-1
+- upgrade to upstream version 5.5.7
+- update configuration and init files for the new major version
+- add several directories for storing auxiliary data
+- add ChangeLog to documentation
+- drop unlimited-select.patch; integrated upstream
+- add rsyslog-5.5.7-remove_include.patch to fix compilation
+
+* Tue Sep 07 2010 Tomas Heinrich <theinric@redhat.com> 4.6.3-2
+- build rsyslog with PIE and RELRO
+
+* Thu Jul 15 2010 Tomas Heinrich <theinric@redhat.com> 4.6.3-1
+- upgrade to new upstream stable version 4.6.3
+
+* Wed Apr 07 2010 Tomas Heinrich <theinric@redhat.com> 4.6.2-1
+- upgrade to new upstream stable version 4.6.2
+- correct the default value of the OMFileFlushOnTXEnd directive
+
+* Thu Feb 11 2010 Tomas Heinrich <theinric@redhat.com> 4.4.2-6
+- modify rsyslog-4.4.2-unlimited-select.patch so that
+ running autoreconf is not needed
+- remove autoconf, automake, libtool from BuildRequires
+- change exec-prefix to nil
+
+* Wed Feb 10 2010 Tomas Heinrich <theinric@redhat.com> 4.4.2-5
+- remove '_smp_mflags' make argument as it seems to be
+ producing corrupted builds
+
+* Mon Feb 08 2010 Tomas Heinrich <theinric@redhat.com> 4.4.2-4
+- redefine _libdir as it doesn't use _exec_prefix
+
+* Thu Dec 17 2009 Tomas Heinrich <theinric@redhat.com> 4.4.2-3
+- change exec-prefix to /
+
+* Wed Dec 09 2009 Robert Scheck <robert@fedoraproject.org> 4.4.2-2
+- run libtoolize to avoid errors due mismatching libtool version
+
+* Thu Dec 03 2009 Tomas Heinrich <theinric@redhat.com> 4.4.2-1
+- upgrade to new upstream stable version 4.4.2
+- add support for arbitrary number of open file descriptors
+
+* Mon Sep 14 2009 Tomas Heinrich <theinric@redhat.com> 4.4.1-2
+- adjust init script according to guidelines (#522071)
+
+* Thu Sep 03 2009 Tomas Heinrich <theinric@redhat.com> 4.4.1-1
+- upgrade to new upstream stable version
+
+* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 4.2.0-3
+- rebuilt with new openssl
+
+* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.2.0-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Tue Jul 14 2009 Tomas Heinrich <theinric@redhat.com> 4.2.0-1
+- upgrade
+
+* Mon Apr 13 2009 Tomas Heinrich <theinric@redhat.com> 3.21.11-1
+- upgrade
+
+* Tue Mar 31 2009 Lubomir Rintel <lkundrak@v3.sk> 3.21.10-4
+- Backport HUPisRestart option
+
+* Wed Mar 18 2009 Tomas Heinrich <theinric@redhat.com> 3.21.10-3
+- fix variables' type conversion in expression-based filters (#485937)
+
+* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.21.10-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Tue Feb 10 2009 Tomas Heinrich <theinric@redhat.com> 3.21.10-1
+- upgrade
+
+* Sat Jan 24 2009 Caolán McNamara <caolanm@redhat.com> 3.21.9-3
+- rebuild for dependencies
+
+* Tue Jan 07 2009 Tomas Heinrich <theinric@redhat.com> 3.21.9-2
+- fix several legacy options handling
+- fix internal message output (#478612)
+
+* Mon Dec 15 2008 Peter Vrabec <pvrabec@redhat.com> 3.21.9-1
+- update is fixing $AllowedSender security issue
+
+* Mon Sep 15 2008 Peter Vrabec <pvrabec@redhat.com> 3.21.3-4
+- use RPM_OPT_FLAGS
+- use same pid file and logrotate file as syslog-ng (#441664)
+- mark config files as noreplace (#428155)
+
+* Mon Sep 01 2008 Tomas Heinrich <theinric@redhat.com> 3.21.3-3
+- fix a wrong module name in the rsyslog.conf manual page (#455086)
+- expand the rsyslog.conf manual page (#456030)
+
+* Thu Aug 28 2008 Tomas Heinrich <theinric@redhat.com> 3.21.3-2
+- fix clock rollback issue (#460230)
+
+* Wed Aug 20 2008 Peter Vrabec <pvrabec@redhat.com> 3.21.3-1
+- upgrade to bugfix release
+
+* Wed Jul 23 2008 Peter Vrabec <pvrabec@redhat.com> 3.21.0-1
+- upgrade
+
+* Mon Jul 14 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.9-2
+- adjust default config file
+
+* Fri Jul 11 2008 Lubomir Rintel <lkundrak@v3.sk> 3.19.9-1
+- upgrade
+
+* Wed Jun 25 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.7-3
+- rebuild because of new gnutls
+
+* Fri Jun 13 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.7-2
+- do not translate Oopses (#450329)
+
+* Fri Jun 13 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.7-1
+- upgrade
+
+* Wed May 28 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.4-1
+- upgrade
+
+* Mon May 26 2008 Peter Vrabec <pvrabec@redhat.com> 3.19.3-1
+- upgrade to new upstream release
+
+* Wed May 14 2008 Tomas Heinrich <theinric@redhat.com> 3.16.1-1
+- upgrade
+
+* Tue Apr 08 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-5
+- prevent undesired error description in legacy
+ warning messages
+
+* Tue Apr 08 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-4
+- adjust symbol lookup method to 2.6 kernel
+
+* Tue Apr 08 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-3
+- fix segfault of expression based filters
+
+* Mon Apr 07 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-2
+- init script fixes (#441170,#440968)
+
+* Fri Apr 04 2008 Peter Vrabec <pvrabec@redhat.com> 3.14.1-1
+- upgrade
+
+* Mon Mar 25 2008 Peter Vrabec <pvrabec@redhat.com> 3.12.4-1
+- upgrade
+
+* Wed Mar 19 2008 Peter Vrabec <pvrabec@redhat.com> 3.12.3-1
+- upgrade
+- fix some significant memory leaks
+
+* Tue Mar 11 2008 Peter Vrabec <pvrabec@redhat.com> 3.12.1-2
+- init script fixes (#436854)
+- fix config file parsing (#436722)
+
+* Thu Mar 06 2008 Peter Vrabec <pvrabec@redhat.com> 3.12.1-1
+- upgrade
+
+* Wed Mar 05 2008 Peter Vrabec <pvrabec@redhat.com> 3.12.0-1
+- upgrade
+
+* Mon Feb 25 2008 Peter Vrabec <pvrabec@redhat.com> 3.11.5-1
+- upgrade
+
+* Fri Feb 01 2008 Peter Vrabec <pvrabec@redhat.com> 3.11.0-1
+- upgrade to the latests development release
+- provide PostgresSQL support
+- provide GSSAPI support
+
+* Mon Jan 21 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-7
+- change from requires sysklogd to conflicts sysklogd
+
+* Fri Jan 18 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-6
+- change logrotate file
+- use rsyslog own pid file
+
+* Thu Jan 17 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-5
+- fixing bad descriptor (#428775)
+
+* Wed Jan 16 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-4
+- rename logrotate file
+
+* Wed Jan 16 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-3
+- fix post script and init file
+
+* Wed Jan 16 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-2
+- change pid filename and use logrotata script from sysklogd
+
+* Tue Jan 15 2008 Peter Vrabec <pvrabec@redhat.com> 2.0.0-1
+- upgrade to stable release
+- spec file clean up
+
+* Wed Jan 02 2008 Peter Vrabec <pvrabec@redhat.com> 1.21.2-1
+- new upstream release
+
+* Thu Dec 06 2007 Release Engineering <rel-eng at fedoraproject dot org> - 1.19.11-2
+- Rebuild for deps
+
+* Thu Nov 29 2007 Peter Vrabec <pvrabec@redhat.com> 1.19.11-1
+- new upstream release
+- add conflicts (#400671)
+
+* Mon Nov 19 2007 Peter Vrabec <pvrabec@redhat.com> 1.19.10-1
+- new upstream release
+
+* Wed Oct 03 2007 Peter Vrabec <pvrabec@redhat.com> 1.19.6-3
+- remove NUL character from recieved messages
+
+* Tue Sep 25 2007 Tomas Heinrich <theinric@redhat.com> 1.19.6-2
+- fix message suppression (303341)
+
+* Tue Sep 25 2007 Tomas Heinrich <theinric@redhat.com> 1.19.6-1
+- upstream bugfix release
+
+* Tue Aug 28 2007 Peter Vrabec <pvrabec@redhat.com> 1.19.2-1
+- upstream bugfix release
+- support for negative app selector, patch from
+ theinric@redhat.com
+
+* Fri Aug 17 2007 Peter Vrabec <pvrabec@redhat.com> 1.19.0-1
+- new upstream release with MySQL support(as plugin)
+
+* Wed Aug 08 2007 Peter Vrabec <pvrabec@redhat.com> 1.18.1-1
+- upstream bugfix release
+
+* Mon Aug 06 2007 Peter Vrabec <pvrabec@redhat.com> 1.18.0-1
+- new upstream release
+
+* Thu Aug 02 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.6-1
+- upstream bugfix release
+
+* Mon Jul 30 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.5-1
+- upstream bugfix release
+- fix typo in provides
+
+* Wed Jul 25 2007 Jeremy Katz <katzj@redhat.com> - 1.17.2-4
+- rebuild for toolchain bug
+
+* Tue Jul 24 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.2-3
+- take care of sysklogd configuration files in %%post
+
+* Tue Jul 24 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.2-2
+- use EVR in provides/obsoletes sysklogd
+
+* Mon Jul 23 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.2-1
+- upstream bug fix release
+
+* Fri Jul 20 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.1-1
+- upstream bug fix release
+- include html docs (#248712)
+- make "-r" option compatible with sysklogd config (248982)
+
+* Tue Jul 17 2007 Peter Vrabec <pvrabec@redhat.com> 1.17.0-1
+- feature rich upstream release
+
+* Thu Jul 12 2007 Peter Vrabec <pvrabec@redhat.com> 1.15.1-2
+- use obsoletes and hadle old config files
+
+* Wed Jul 11 2007 Peter Vrabec <pvrabec@redhat.com> 1.15.1-1
+- new upstream bugfix release
+
+* Tue Jul 10 2007 Peter Vrabec <pvrabec@redhat.com> 1.15.0-1
+- new upstream release introduce capability to generate output
+ file names based on templates
+
+* Tue Jul 03 2007 Peter Vrabec <pvrabec@redhat.com> 1.14.2-1
+- new upstream bugfix release
+
+* Mon Jul 02 2007 Peter Vrabec <pvrabec@redhat.com> 1.14.1-1
+- new upstream release with IPv6 support
+
+* Tue Jun 26 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.5-3
+- add BuildRequires for zlib compression feature
+
+* Mon Jun 25 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.5-2
+- some spec file adjustments.
+- fix syslog init script error codes (#245330)
+
+* Fri Jun 22 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.5-1
+- new upstream release
+
+* Fri Jun 22 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.4-2
+- some spec file adjustments.
+
+* Mon Jun 18 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.4-1
+- upgrade to new upstream release
+
+* Wed Jun 13 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.2-2
+- DB support off
+
+* Tue Jun 12 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.2-1
+- new upstream release based on redhat patch
+
+* Fri Jun 08 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.1-2
+- rsyslog package provides its own kernel log. daemon (rklogd)
+
+* Mon Jun 04 2007 Peter Vrabec <pvrabec@redhat.com> 1.13.1-1
+- Initial rpm build
diff --git a/build/rhel/rsyslog/rsyslog.sysconfig b/build/rhel/rsyslog/rsyslog.sysconfig
new file mode 100644
index 00000000..04c6c533
--- /dev/null
+++ b/build/rhel/rsyslog/rsyslog.sysconfig
@@ -0,0 +1,7 @@
+# Options for rsyslogd
+# Syslogd options are deprecated since rsyslog v3.
+# If you want to use them, switch to compatibility mode 2 by "-c 2"
+# See rsyslogd(8) for more details
+#
+# Assume compatibily with version 5 or greater
+SYSLOGD_OPTIONS="-c5 -f /etc/rsyslog.conf"
diff --git a/configure.ac b/configure.ac
index 94d43d85..3c068d0d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[6.3.8],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[6.3.11],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -40,7 +40,7 @@ case "${host}" in
AC_DEFINE([OS_LINUX], [1], [Indicator for a Linux OS])
os_type="linux"
;;
- *-*-*darwin*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
+ *-*-*darwin*|*-*-dragonfly*|*-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
AC_DEFINE([OS_BSD], [1], [Indicator for a BSD OS])
os_type="bsd"
;;
@@ -517,8 +517,24 @@ if test "x$enable_mysql" = "xyes"; then
[AC_MSG_FAILURE([MySQL library is missing])],
[`mysql_config --libs`]
)
+ AC_MSG_CHECKING(if we have mysql_library_init)
+ save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $MYSQL_CFLAGS"
+ save_LIBS="$LIBS"
+ LIBS="$LIBS $MYSQL_LIBS"
+ AC_TRY_LINK(
+ [#include <mysql.h>
+ #include <stdio.h>],
+ [mysql_library_init(0, NULL, NULL)],
+ [have_mysql_library_init=yes],
+ [have_mysql_library_init=no])
+ CFLAGS="$save_CFLAGS"
+ LIBS="$save_LIBS"
fi
AM_CONDITIONAL(ENABLE_MYSQL, test x$enable_mysql = xyes)
+if test "$have_mysql_library_init" = "yes"; then
+ AC_DEFINE([HAVE_MYSQL_LIBRARY_INIT], [1], [mysql_library_init available])
+fi
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS)
@@ -736,11 +752,15 @@ AC_ARG_ENABLE(rsyslogrt,
[enable_rsyslogrt=yes]
)
if test "x$enable_rsyslogrt" = "xyes"; then
- RSRT_CFLAGS="-I\$(top_srcdir)/runtime -I\$(top_srcdir) -I\$(top_srcdir)/grammar"
- RSRT_LIBS="\$(top_builddir)/runtime/librsyslog.la"
+ RSRT_CFLAGS1="-I\$(top_srcdir)/runtime -I\$(top_srcdir) -I\$(top_srcdir)/grammar"
+ RSRT_LIBS1="\$(top_builddir)/runtime/librsyslog.la"
#??CNF_LIBS="\$(top_builddir)/grammar/libgrammar.la"
fi
AM_CONDITIONAL(ENABLE_RSYSLOGRT, test x$enable_rsyslogrt = xyes)
+RSRT_CFLAGS="\$(RSRT_CFLAGS1) \$(LIBESTR_CFLAGS)"
+RSRT_LIBS="\$(RSRT_LIBS1) \$(LIBESTR_LIBS)"
+AC_SUBST(RSRT_CFLAGS1)
+AC_SUBST(RSRT_LIBS1)
AC_SUBST(RSRT_CFLAGS)
AC_SUBST(RSRT_LIBS)
@@ -1172,16 +1192,16 @@ AM_CONDITIONAL(ENABLE_CUST1, test x$enable_cust1 = xyes)
# A custom strgen that also serves as a sample of how to do
# SQL-generating strgen's
-AC_ARG_ENABLE(smcustbindcdr,
- [AS_HELP_STRING([--enable-smcustbindcdr],[Compiles smcustbindcdr module @<:@default=no@:>@])],
+AC_ARG_ENABLE(sm_cust_bindcdr,
+ [AS_HELP_STRING([--enable-sm_cust_bindcdr],[Compiles sm_cust_bindcdr module @<:@default=no@:>@])],
[case "${enableval}" in
- yes) enable_smcustbindcdr="yes" ;;
- no) enable_smcustbindcdr="no" ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-smcustbindcdr) ;;
+ yes) enable_sm_cust_bindcdr="yes" ;;
+ no) enable_sm_cust_bindcdr="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-sm_cust_bindcdr) ;;
esac],
- [enable_smcustbindcdr=no]
+ [enable_sm_cust_bindcdr=no]
)
-AM_CONDITIONAL(ENABLE_SMCUSTBINDCDR, test x$enable_smcustbindcdr = xyes)
+AM_CONDITIONAL(ENABLE_SMCUSTBINDCDR, test x$enable_sm_cust_bindcdr = xyes)
# settings for mmsnmptrapd message modification module
diff --git a/doc/manual.html b/doc/manual.html
index 8f74e806..1bc8f1f7 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -19,7 +19,7 @@ rsyslog support</a> available directly from the source!</p>
<p><b>Please visit the <a href="http://www.rsyslog.com/sponsors">rsyslog sponsor's page</a>
to honor the project sponsors or become one yourself!</b> We are very grateful for any help towards the
project goals.</p>
-<p><b>This documentation is for version 6.3.8 (devel branch) of rsyslog.</b>
+<p><b>This documentation is for version 6.3.11 (beta branch) of rsyslog.</b>
Visit the <i><a href="http://www.rsyslog.com/status">rsyslog status page</a></i></b>
to obtain current version information and project status.
</p><p><b>If you like rsyslog, you might
diff --git a/doc/omudpspoof.html b/doc/omudpspoof.html
index 16cb9b13..df14bbe1 100644
--- a/doc/omudpspoof.html
+++ b/doc/omudpspoof.html
@@ -16,7 +16,7 @@ spoof the sender address. Also, it enables to circle through a number of
source ports.
<p><b>Configuration Directives</b>:</p>
<ul>
-<li><b>$ActionOMUDPSpoofSourceNameTemplate</b> &lt;templatename&gt;<br>
+<li><b>$ActionOMOMUDPSpoofSourceNameTemplate</b> &lt;templatename&gt;<br>
This is the name of the template that contains a
numerical IP address that is to be used as the source system IP address.
While it may often be a constant value, it can be generated as usual via the
@@ -28,7 +28,7 @@ So in essence, the default template spoofs the address of the system the message
was received from. This is considered the most important use case.
<li><b>$ActionOMUDPSpoofTargetHost</b> &lt;hostname&gt;<br>
Host that the messages shall be sent to.
-<li><b>$ActionUDPSpoofTargetPort</b> &lt;port&gt;<br>
+<li><b>$ActionOMUDPSpoofTargetPort</b> &lt;port&gt;<br>
Remote port that the messages shall be sent to.
<li><b>$ActionOMUDPSpoofDefaultTemplate</b> &lt;templatename&gt;<br>
This setting instructs omudpspoof to use a template different from the
@@ -53,7 +53,7 @@ care about the source port. This example is considered the typical use case for
omudpspoof.
</p>
<textarea rows="5" cols="80">$ModLoad omudpspoof
-$ActionUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofTargetHost server.example.com
*.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :omudpspoof:
</textarea>
@@ -64,10 +64,10 @@ source port 514 is used.
<textarea rows="8" cols="80">$ModLoad omudpspoof
$template spoofaddr,"192.0.2.1"
$template spooftemplate,"%rawmsg%"
-$ActionUDPSpoofSourceNameTemplate spoofaddr
-$ActionUDPSpoofTargetHost server.example.com
-$ActionUDPSpoofSourcePortStart 514
-$ActionUDPSpoofSourcePortEnd 514
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofSourcePortStart 514
+$ActionOMUDPSpoofSourcePortEnd 514
*.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :omudpspoof:;spooftemplate
</textarea>
<p>The following sample is similar to the previous, but uses as many defaults as possible.
@@ -77,8 +77,8 @@ have been changed, the previously set defaults will be used!
</p>
<textarea rows="5" cols="80">$ModLoad omudpspoof
$template spoofaddr,"192.0.2.1"
-$ActionUDPSpoofSourceNameTemplate spoofaddr
-$ActionUDPSpoofTargetHost server.example.com
+$ActionOMUDPSpoofSourceNameTemplate spoofaddr
+$ActionOMUDPSpoofTargetHost server.example.com
*.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :omudpspoof:
</textarea>
<p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
@@ -86,7 +86,7 @@ $ActionUDPSpoofTargetHost server.example.com
<p><font size="2">This documentation is part of the
<a href="http://www.rsyslog.com/">rsyslog</a>
project.<br>
-Copyright &copy; 2009 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
+Copyright &copy; 2009-2012 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
<a href="http://www.adiscon.com/">Adiscon</a>.
Released under the GNU GPL version 3 or higher.</font></p>
</body></html>
diff --git a/doc/property_replacer.html b/doc/property_replacer.html
index 5ee1d096..4c92bf4c 100644
--- a/doc/property_replacer.html
+++ b/doc/property_replacer.html
@@ -304,6 +304,15 @@ fields in the property is requested. The field number must be placed in
the "ToChar" parameter. An example where the 3rd field (delimited by
TAB) from the msg property is extracted is as follows: "%msg:F:3%". The
same example with semicolon as delimiter is "%msg:F,59:3%".</p>
+<p>The use of fields does not permit to select substrings, what is rather
+unfortunate. To solve this issue, starting with 6.3.9, fromPos and toPos
+can be specified for strings as well. However, the syntax is quite ugly, but
+it was the only way to integrate this functonality into the already-existing
+system. To do so, use ",fromPos" and ",toPos" during field extraction.
+Let's assume you want to extract the substring from position 5 to 9 in the previous
+example. Then, the syntax is as follows: "%msg:F,59,5:3,9%". As you can see,
+"F,59" means field-mode, with semicolon delimiter and ",5" means starting
+at position 5. Then "3,9" means field 3 and string extraction to position 9.
<p>Please note that the special characters "F" and "R" are
case-sensitive. Only upper case works, lower case will return an error.
There are no white spaces permitted inside the sequence (that will lead
diff --git a/grammar/Makefile.am b/grammar/Makefile.am
index 5911f443..d231bb46 100644
--- a/grammar/Makefile.am
+++ b/grammar/Makefile.am
@@ -13,7 +13,7 @@ libgrammar_la_SOURCES = \
grammar.h
libgrammar_la_CPPFLAGS = $(RSRT_CFLAGS)
-testdriver_SOURCES = testdriver.c libgrammar.la
-testdriver_CPPFLAGS = $(RSRT_CFLAGS)
-testdriver_LDADD = libgrammar.la
-testdriver_LDFLAGS = -lestr
+#testdriver_SOURCES = testdriver.c libgrammar.la
+#testdriver_CPPFLAGS = $(RSRT_CFLAGS)
+#testdriver_LDADD = libgrammar.la
+#testdriver_LDFLAGS = -lestr
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index d1d64e6e..a5cc10c2 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -623,14 +623,13 @@ cnfactlstAddSysline(struct cnfactlst* actlst, char *line)
struct cnfcfsyslinelst *cflst;
if((cflst = malloc(sizeof(struct cnfcfsyslinelst))) != NULL) {
- cflst->next = NULL;
cflst->line = line;
if(actlst->syslines == NULL) {
- actlst->syslines = cflst;
+ cflst->next = NULL;
} else {
cflst->next = actlst->syslines;
- actlst->syslines = cflst;
}
+ actlst->syslines = cflst;
}
return actlst;
}
@@ -743,9 +742,11 @@ var2Number(struct var *r, int *bSuccess)
if(r->datatype == 'S') {
n = es_str2num(r->d.estr, bSuccess);
} else {
- *bSuccess = 1;
+ n = r->d.n;
+ if(bSuccess)
+ *bSuccess = 1;
}
- return r->d.n;
+ return n;
}
/* ensure that retval is a string; if string is no number,
@@ -1128,8 +1129,9 @@ cnfexprEval(struct cnfexpr *expr, struct var *ret, void* usrptr)
ret->d.n = 1ll;
else
ret->d.n = 0ll;
+ if(r.datatype == 'S') es_deleteStr(r.d.estr);
}
- FREE_BOTH_RET;
+ if(l.datatype == 'S') es_deleteStr(l.d.estr);
break;
case AND:
cnfexprEval(expr->l, &l, usrptr);
@@ -1140,10 +1142,11 @@ cnfexprEval(struct cnfexpr *expr, struct var *ret, void* usrptr)
ret->d.n = 1ll;
else
ret->d.n = 0ll;
+ if(r.datatype == 'S') es_deleteStr(r.d.estr);
} else {
ret->d.n = 0ll;
}
- FREE_BOTH_RET;
+ if(l.datatype == 'S') es_deleteStr(l.d.estr);
break;
case NOT:
cnfexprEval(expr->r, &r, usrptr);
@@ -1408,6 +1411,9 @@ cnfrulePrint(struct cnfrule *rule)
dbgprintf("------ end rule %p\n", rule);
}
+/* note: the sysline itself was already freed during processing
+ * and as such MUST NOT be freed again!
+ */
void
cnfcfsyslinelstDestruct(struct cnfcfsyslinelst *cfslst)
{
@@ -1415,7 +1421,6 @@ cnfcfsyslinelstDestruct(struct cnfcfsyslinelst *cfslst)
while(cfslst != NULL) {
toDel = cfslst;
cfslst = cfslst->next;
- free(toDel->line);
free(toDel);
}
}
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 90b424f3..f476c5ff 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -82,7 +82,6 @@ typedef struct configSettings_s {
int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */
uchar *pszPath;
int console_log_level;
- char *symfile; /* TODO: actually unsued currently! */
} configSettings_t;
static configSettings_t cs;
@@ -104,7 +103,6 @@ initConfigSettings(void)
cs.bPermitNonKernel = 0;
cs.console_log_level = -1;
cs.pszPath = NULL;
- cs.symfile = NULL;
cs.iFacilIntMsg = klogFacilIntMsg();
}
@@ -194,11 +192,9 @@ rsRetVal imklogLogIntMsg(int priority, char *fmt, ...)
DEFiRet;
va_list ap;
uchar msgBuf[2048]; /* we use the same size as sysklogd to remain compatible */
- uchar *pLogMsg;
va_start(ap, fmt);
vsnprintf((char*)msgBuf, sizeof(msgBuf) / sizeof(char), fmt, ap);
- pLogMsg = msgBuf;
va_end(ap);
logmsgInternal(NO_ERRCODE ,priority, msgBuf, 0);
@@ -302,21 +298,8 @@ CODESTARTendCnfLoad
loadModConf->pszPath = cs.pszPath;
}
cs.pszPath = NULL;
- if((cs.symfile == NULL) || (cs.symfile[0] == '\0')) {
- loadModConf->symfile = NULL;
- if(cs.symfile != NULL)
- free(cs.symfile);
- } else {
- loadModConf->symfile = cs.symfile;
- }
- cs.symfile = NULL;
loadModConf = NULL; /* done loading */
- /* free legacy config vars */
- free(cs.pszPath);
- cs.pszPath = NULL;
- free(cs.symfile);
- cs.symfile = NULL;
ENDendCnfLoad
@@ -380,7 +363,6 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
cs.dbgPrintSymbols = 0;
cs.symbols_twice = 0;
cs.use_syscall = 0;
- cs.symfile = NULL;
cs.symbol_lookup = 0;
cs.bPermitNonKernel = 0;
if(cs.pszPath != NULL) {
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index 7f6c810a..795dd68c 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -39,7 +39,6 @@ struct modConfData_s {
int iFacilIntMsg;
uchar *pszPath;
int console_log_level;
- char *symfile;
rsconf_t *pConf;
};
@@ -54,21 +53,6 @@ rsRetVal klogWillRun(modConfData_t *pModConf);
rsRetVal klogAfterRun(modConfData_t *pModConf);
int klogFacilIntMsg();
-/* the following data members may be accessed by the "drivers"
- * I admit this is not the cleanest way to doing things, but I honestly
- * believe it is appropriate for the job that needs to be done.
- * rgerhards, 2008-04-09
- */
-#if 0
-extern int symbols_twice;
-extern int use_syscall;
-extern int symbol_lookup;
-extern char *symfile;
-extern int console_log_level;
-extern int dbgPrintSymbols;
-extern uchar *pszPath;
-#endif
-
/* the functions below may be called by the drivers */
rsRetVal imklogLogIntMsg(int priority, char *fmt, ...) __attribute__((format(printf,2, 3)));
rsRetVal Syslog(int priority, uchar *msg, struct timeval *tp);
diff --git a/plugins/imptcp/imptcp.c b/plugins/imptcp/imptcp.c
index ba323a94..6961a696 100644
--- a/plugins/imptcp/imptcp.c
+++ b/plugins/imptcp/imptcp.c
@@ -262,6 +262,7 @@ destructSrv(ptcpsrv_t *pSrv)
{
prop.Destruct(&pSrv->pInputName);
pthread_mutex_destroy(&pSrv->mutSessLst);
+ free(pSrv->pszInputName);
free(pSrv->port);
free(pSrv);
}
@@ -1071,7 +1072,7 @@ addListner(modConfData_t __attribute__((unused)) *modConf, instanceConf_t *inst)
CHKmalloc(pSrv->lstnIP = ustrdup(inst->pszBindAddr));
}
pSrv->pRuleset = inst->pBindRuleset;
- pSrv->pszInputName = (inst->pszInputName == NULL) ? UCHAR_CONSTANT("imptcp") : ustrdup(inst->pszInputName);
+ pSrv->pszInputName = ustrdup((inst->pszInputName == NULL) ? UCHAR_CONSTANT("imptcp") : inst->pszInputName);
CHKiRet(prop.Construct(&pSrv->pInputName));
CHKiRet(prop.SetString(pSrv->pInputName, pSrv->pszInputName, ustrlen(pSrv->pszInputName)));
CHKiRet(prop.ConstructFinalize(pSrv->pInputName));
@@ -1362,6 +1363,8 @@ CODESTARTendCnfLoad
/* free legacy config vars */
free(cs.pszInputName);
free(cs.lstnIP);
+ cs.pszInputName = NULL;
+ cs.lstnIP = NULL;
ENDendCnfLoad
diff --git a/plugins/ommongodb/README b/plugins/ommongodb/README
index 71d56cfa..7581131a 100644
--- a/plugins/ommongodb/README
+++ b/plugins/ommongodb/README
@@ -2,21 +2,6 @@ plugin to use MongoDB as backend.
tested in ubuntu 10.04 and ubuntu 10.10
-BUILDING THIS PLUGIN
-Right now, it seems to be necessary to copy the 10gen c-driver directly under
-the ./plugins/ommongodb subdirectory. Then, you need to follow their build
-instructions on how to build the mongodb c driver:
-http://api.mongodb.org/c/current/building.html
-
-This is clumpsy, and if someone has ideas on how to improve this situation,
-please drop us a line. For obvious reasons, ./configure does not detect
-a missing mongodb c driver.
-
-In order to successfully build ommongodb, you NEED to use the v0.2 version of
-the mongo c driver. As it looks, the driver breaks API compatibility and the
-curret v0.4 driver seems to have a totally different API (at least this is
-what I currently (2012-03-08) see.
-
configuration:
in your /etc/rsyslog.conf, together with other modules:
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 32d4d73a..253fc4c0 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -120,7 +120,6 @@ static void closeMySQL(instanceData *pData)
ASSERT(pData != NULL);
if(pData->f_hmysql != NULL) { /* just to be on the safe side... */
- mysql_server_end();
mysql_close(pData->f_hmysql);
pData->f_hmysql = NULL;
}
@@ -426,6 +425,11 @@ ENDparseSelectorAct
BEGINmodExit
CODESTARTmodExit
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_end();
+# else
+ mysql_server_end();
+# endif
ENDmodExit
@@ -455,6 +459,20 @@ INITLegCnfVars
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+
+ /* we need to init the MySQL library. If that fails, we cannot run */
+ if(
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_init(0, NULL, NULL)
+# else
+ mysql_server_init(0, NULL, NULL)
+# endif
+ ) {
+ errmsg.LogError(0, NO_ERRCODE, "ommysql: mysql_server_init() failed, plugin "
+ "can not run");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
/* register our config handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &cs.iSrvPort, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"ommysqlconfigfile",0,eCmdHdlrGetWord,NULL,&cs.pszMySQLConfigFile,STD_LOADABLE_MODULE_ID));
diff --git a/plugins/omudpspoof/omudpspoof.c b/plugins/omudpspoof/omudpspoof.c
index 506fca77..43b36551 100644
--- a/plugins/omudpspoof/omudpspoof.c
+++ b/plugins/omudpspoof/omudpspoof.c
@@ -24,7 +24,7 @@
* rgerhards, 2009-07-10
*
* Copyright 2009 David Lang (spoofing code)
- * Copyright 2009 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2009-2012 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -132,6 +132,7 @@ ENDinitConfVars
/* add some variables needed for libnet */
libnet_t *libnet_handle;
char errbuf[LIBNET_ERRBUF_SIZE];
+pthread_mutex_t mutLibnet;
/* forward definitions */
static rsRetVal doTryResume(instanceData *pData);
@@ -194,6 +195,8 @@ ENDdbgPrintInstInfo
/* Send a message via UDP
+ * Note: libnet is not thread-safe, so we need to ensure that only one
+ * instance ever is calling libnet code.
* rgehards, 2007-12-20
*/
static inline rsRetVal
@@ -202,11 +205,10 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
struct addrinfo *r;
int lsent = 0;
int bSendSuccess;
- int j, build_ip;
- u_char opt[20];
struct sockaddr_in *tempaddr,source_ip;
libnet_ptag_t ip, ipo;
libnet_ptag_t udp;
+ sbool bNeedUnlock = 0;
DEFiRet;
if(pData->pSockArray == NULL) {
@@ -221,6 +223,8 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
inet_pton(AF_INET, (char*)pszSourcename, &(source_ip.sin_addr));
bSendSuccess = FALSE;
+ d_pthread_mutex_lock(&mutLibnet);
+ bNeedUnlock = 1;
for (r = pData->f_addr; r; r = r->ai_next) {
tempaddr = (struct sockaddr_in *)r->ai_addr;
libnet_clear_packet(libnet_handle);
@@ -238,17 +242,8 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
DBGPRINTF("Can't build UDP header: %s\n", libnet_geterror(libnet_handle));
}
- build_ip = 0;
- /* this is not a legal options string */
- for (j = 0; j < 20; j++) {
- opt[j] = libnet_get_prand(LIBNET_PR2);
- }
- ipo = libnet_build_ipv4_options(opt, 20, libnet_handle, ipo);
- if (ipo == -1) {
- DBGPRINTF("Can't build IP options: %s\n", libnet_geterror(libnet_handle));
- }
ip = libnet_build_ipv4(
- LIBNET_IPV4_H + 20 + len + LIBNET_UDP_H, /* length */
+ LIBNET_IPV4_H + len + LIBNET_UDP_H, /* length */
0, /* TOS */
242, /* IP ID */
0, /* IP Frag */
@@ -281,6 +276,9 @@ UDPSend(instanceData *pData, uchar *pszSourcename, char *msg, size_t len)
}
finalize_it:
+ if(bNeedUnlock) {
+ d_pthread_mutex_unlock(&mutLibnet);
+ }
RETiRet;
}
@@ -422,7 +420,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(2)
pData->port = NULL;
else
CHKmalloc(pData->port = ustrdup(cs.pszTargetPort));
- CHKiRet(OMSRsetEntry(*ppOMSR, 1, ustrdup(cs.pszSourceNameTemplate), OMSR_NO_RQD_TPL_OPTS));
+ CHKiRet(OMSRsetEntry(*ppOMSR, 1, ustrdup(sourceTpl), OMSR_NO_RQD_TPL_OPTS));
pData->compressionLevel = cs.iCompressionLevel;
pData->sourcePort = pData->sourcePortStart = cs.iSourcePortStart;
pData->sourcePortEnd = cs.iSourcePortEnd;
@@ -454,6 +452,7 @@ BEGINmodExit
CODESTARTmodExit
/* destroy the libnet state needed for forged UDP sources */
libnet_destroy(libnet_handle);
+ pthread_mutex_destroy(&mutLibnet);
/* release what we no longer need */
objRelease(errmsg, CORE_COMPONENT);
objRelease(glbl, CORE_COMPONENT);
@@ -503,6 +502,7 @@ CODEmodInit_QueryRegCFSLineHdlr
errmsg.LogError(0, NO_ERRCODE, "Error initializing libnet, can not continue ");
ABORT_FINALIZE(RS_RET_ERR_LIBNET_INIT);
}
+ pthread_mutex_init(&mutLibnet, NULL);
CHKiRet(regCfSysLineHdlr((uchar *)"actionomudpspoofdefaulttemplate", 0, eCmdHdlrGetWord, NULL, &cs.pszTplName, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"actionomudpspoofsourcenametemplate", 0, eCmdHdlrGetWord, NULL, &cs.pszSourceNameTemplate, NULL));
diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c
index af88b3de..fdbb8f2a 100644
--- a/runtime/cfsysline.c
+++ b/runtime/cfsysline.c
@@ -346,11 +346,12 @@ static int doParseOnOffOption(uchar **pp)
*/
static rsRetVal doGetGID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *pVal)
{
- struct group *pgBuf;
+ struct group *pgBuf = NULL;
struct group gBuf;
DEFiRet;
uchar szName[256];
- char stringBuf[2048]; /* I hope this is large enough... */
+ int bufSize = 2048;
+ char * stringBuf = NULL;
assert(pp != NULL);
assert(*pp != NULL);
@@ -360,7 +361,17 @@ static rsRetVal doGetGID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *p
ABORT_FINALIZE(RS_RET_NOT_FOUND);
}
- getgrnam_r((char*)szName, &gBuf, stringBuf, sizeof(stringBuf), &pgBuf);
+
+ CHKmalloc(stringBuf = malloc(bufSize));
+ while(pgBuf == NULL) {
+ errno = 0;
+ getgrnam_r((char*)szName, &gBuf, stringBuf, bufSize, &pgBuf);
+ if((pgBuf == NULL) && (errno == ERANGE)) {
+ /* Increase bufsize and try again.*/
+ bufSize *= 2;
+ CHKmalloc(stringBuf = realloc(stringBuf, bufSize));
+ }
+ }
if(pgBuf == NULL) {
errmsg.LogError(0, RS_RET_NOT_FOUND, "ID for group '%s' could not be found or error", (char*)szName);
@@ -379,6 +390,7 @@ static rsRetVal doGetGID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *p
skipWhiteSpace(pp); /* skip over any whitespace */
finalize_it:
+ free(stringBuf);
RETiRet;
}
@@ -935,7 +947,8 @@ rsRetVal processCfSysLineCommand(uchar *pCmdName, uchar **p)
iRet = llFind(&llCmdList, (void *) pCmdName, (void*) &pCmd);
if(iRet == RS_RET_NOT_FOUND) {
- errmsg.LogError(0, RS_RET_NOT_FOUND, "invalid or yet-unknown config file command - have you forgotten to load a module?");
+ errmsg.LogError(0, RS_RET_NOT_FOUND, "invalid or yet-unknown config file command '%s' - "
+ "have you forgotten to load a module?", pCmdName);
}
if(iRet != RS_RET_OK)
diff --git a/runtime/debug.c b/runtime/debug.c
index 955076e2..edc4a255 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -68,7 +68,7 @@ static int bPrintAllDebugOnExit = 0;
static int bAbortTrace = 1; /* print a trace after SIGABRT or SIGSEGV */
static char *pszAltDbgFileName = NULL; /* if set, debug output is *also* sent to here */
static int altdbg = -1; /* and the handle for alternate debug output */
-static int stddbg;
+int stddbg = 1; /* the handle for regular debug output, set to stdout if not forking, -1 otherwise */
/* list of files/objects that should be printed */
typedef struct dbgPrintName_s {
@@ -1303,8 +1303,6 @@ dbgGetRuntimeOptions(void)
uchar *optname;
/* set some defaults */
- stddbg = 1;
-
if((pszOpts = (uchar*) getenv("RSYSLOG_DEBUG")) != NULL) {
/* we have options set, so let's process them */
while(dbgGetRTOptNamVal(&pszOpts, &optname, &optval)) {
diff --git a/runtime/debug.h b/runtime/debug.h
index 717c0fef..26672c3e 100644
--- a/runtime/debug.h
+++ b/runtime/debug.h
@@ -35,6 +35,7 @@
/* external static data elements (some time to be replaced) */
extern int Debug; /* debug flag - read-only after startup */
extern int debugging_on; /* read-only, except on sig USR1 */
+extern int stddbg; /* the handle for regular debug output, set to stdout if not forking, -1 otherwise */
/* data types */
diff --git a/runtime/modules.c b/runtime/modules.c
index 5a87c8be..dac3bd95 100644
--- a/runtime/modules.c
+++ b/runtime/modules.c
@@ -67,14 +67,6 @@ DEFobjCurrIf(errmsg)
DEFobjCurrIf(parser)
DEFobjCurrIf(strgen)
-/* we must ensure that only one thread at one time tries to load or unload
- * modules, otherwise we may see race conditions. This first came up with
- * imdiag/imtcp, which both use the same stream drivers. Below is the mutex
- * for that handling.
- * rgerhards, 2009-05-25
- */
-static pthread_mutex_t mutLoadUnload;
-
static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */
static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */
@@ -819,7 +811,7 @@ modUnlinkAndDestroy(modInfo_t **ppThis)
pThis = *ppThis;
assert(pThis != NULL);
- pthread_mutex_lock(&mutLoadUnload);
+ pthread_mutex_lock(&mutObjGlobalOp);
/* first check if we are permitted to unload */
if(pThis->eType == eMOD_LIB) {
@@ -855,7 +847,7 @@ modUnlinkAndDestroy(modInfo_t **ppThis)
moduleDestruct(pThis);
finalize_it:
- pthread_mutex_unlock(&mutLoadUnload);
+ pthread_mutex_unlock(&mutObjGlobalOp);
RETiRet;
}
@@ -970,7 +962,7 @@ Load(uchar *pModName, sbool bConfLoad)
*/
# define PATHBUF_OVERHEAD 1 + iModNameLen + 3 + 1
- pthread_mutex_lock(&mutLoadUnload);
+ pthread_mutex_lock(&mutObjGlobalOp);
if(iModNameLen > 3 && !strcmp((char *) pModName + iModNameLen - 3, ".so")) {
iModNameLen -= 3;
@@ -1096,7 +1088,7 @@ Load(uchar *pModName, sbool bConfLoad)
finalize_it:
if(pPathBuf != pathBuf) /* used malloc()ed memory? */
free(pPathBuf);
- pthread_mutex_unlock(&mutLoadUnload);
+ pthread_mutex_unlock(&mutObjGlobalOp);
RETiRet;
}
@@ -1193,16 +1185,6 @@ CODESTARTObjClassExit(module)
/* release objects we no longer need */
objRelease(errmsg, CORE_COMPONENT);
objRelease(parser, CORE_COMPONENT);
- /* We have a problem in our reference counting, which leads to this function
- * being called too early. This usually is no problem, but if we destroy
- * the mutex object, we get into trouble. So rather than finding the root cause,
- * we do not release the mutex right now and have a very, very slight leak.
- * We know that otherwise no bad effects happen, so this acceptable for the
- * time being. -- rgerhards, 2009-05-25
- *
- * TODO: add again: pthread_mutex_destroy(&mutLoadUnload);
- */
-
free(pModDir);
# ifdef DEBUG
modUsrPrintAll(); /* debug aid - TODO: integrate with debug.c, at least the settings! */
@@ -1246,7 +1228,6 @@ ENDobjQueryInterface(module)
*/
BEGINAbstractObjClassInit(module, 1, OBJ_IS_CORE_MODULE) /* class, version - CHANGE class also in END MACRO! */
uchar *pModPath;
- pthread_mutexattr_t mutAttr;
/* use any module load path specified in the environment */
if((pModPath = (uchar*) getenv("RSYSLOG_MODDIR")) != NULL) {
@@ -1264,10 +1245,6 @@ BEGINAbstractObjClassInit(module, 1, OBJ_IS_CORE_MODULE) /* class, version - CHA
SetModDir(glblModPath);
}
- pthread_mutexattr_init(&mutAttr);
- pthread_mutexattr_settype(&mutAttr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutex_init(&mutLoadUnload, &mutAttr);
-
/* request objects we use */
CHKiRet(objUse(errmsg, CORE_COMPONENT));
ENDObjClassInit(module)
diff --git a/runtime/msg.c b/runtime/msg.c
index d35e92a7..a7df6928 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1004,11 +1004,15 @@ msg_t* MsgDup(msg_t* pOld)
} else {
tmpCOPYSZ(RawMsg);
}
- if(pOld->iLenHOSTNAME < CONF_HOSTNAME_BUFSIZE) {
- memcpy(pNew->szHOSTNAME, pOld->szHOSTNAME, pOld->iLenHOSTNAME + 1);
- pNew->pszHOSTNAME = pNew->szHOSTNAME;
+ if(pOld->pszHOSTNAME == NULL) {
+ pNew->pszHOSTNAME = NULL;
} else {
- tmpCOPYSZ(HOSTNAME);
+ if(pOld->iLenHOSTNAME < CONF_HOSTNAME_BUFSIZE) {
+ memcpy(pNew->szHOSTNAME, pOld->szHOSTNAME, pOld->iLenHOSTNAME + 1);
+ pNew->pszHOSTNAME = pNew->szHOSTNAME;
+ } else {
+ tmpCOPYSZ(HOSTNAME);
+ }
}
tmpCOPYCSTR(ProgName);
@@ -1638,7 +1642,7 @@ char *getPROCID(msg_t *pM, sbool bLockMutex)
MsgLock(pM);
preparePROCID(pM, MUTEX_ALREADY_LOCKED);
if(pM->pCSPROCID == NULL)
- pszRet = UCHAR_CONSTANT("");
+ pszRet = UCHAR_CONSTANT("-");
else
pszRet = rsCStrGetSzStrNoNULL(pM->pCSPROCID);
if(bLockMutex == LOCK_MUTEX)
@@ -2749,6 +2753,10 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
*pbMustBeFreed = 0;
break;
case PROP_SYS_UPTIME:
+# ifdef OS_SOLARIS
+ pRes = (uchar*) "UPTIME NOT available under Solaris";
+ *pbMustBeFreed = 0;
+# else
{
struct sysinfo s_info;
@@ -2764,6 +2772,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
snprintf((char*) pRes, sizeof(uchar) * 32, "%ld", s_info.uptime);
}
+# endif
break;
default:
/* there is no point in continuing, we may even otherwise render the
@@ -2799,7 +2808,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
*/
iCurrFld = 1;
pFld = pRes;
- while(*pFld && iCurrFld < pTpe->data.field.iToPos) {
+ while(*pFld && iCurrFld < pTpe->data.field.iFieldNr) {
/* skip fields until the requested field or end of string is found */
while(*pFld && (uchar) *pFld != pTpe->data.field.field_delim)
++pFld; /* skip to field terminator */
@@ -2813,9 +2822,9 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
++iCurrFld;
}
}
- dbgprintf("field requested %d, field found %d\n", pTpe->data.field.iToPos, (int) iCurrFld);
+ dbgprintf("field requested %d, field found %d\n", pTpe->data.field.iFieldNr, (int) iCurrFld);
- if(iCurrFld == pTpe->data.field.iToPos) {
+ if(iCurrFld == pTpe->data.field.iFieldNr) {
/* field found, now extract it */
/* first of all, we need to find the end */
pFldEnd = pFld;
@@ -2850,58 +2859,6 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
*pPropLen = sizeof("**FIELD NOT FOUND**") - 1;
return UCHAR_CONSTANT("**FIELD NOT FOUND**");
}
- } else if(pTpe->data.field.iFromPos != 0 || pTpe->data.field.iToPos != 0) {
- /* we need to obtain a private copy */
- int iFrom, iTo;
- uchar *pSb;
- iFrom = pTpe->data.field.iFromPos;
- iTo = pTpe->data.field.iToPos;
- /* need to zero-base to and from (they are 1-based!) */
- if(iFrom > 0)
- --iFrom;
- if(iTo > 0)
- --iTo;
- if(bufLen == -1)
- bufLen = ustrlen(pRes);
- if(iFrom == 0 && iTo >= bufLen) {
- /* in this case, the requested string is a superset of what we already have,
- * so there is no need to do any processing. This is a frequent case for size-limited
- * fields like TAG in the default forwarding template (so it is a useful optimization
- * to check for this condition ;)). -- rgerhards, 2009-07-09
- */
- ; /*DO NOTHING*/
- } else {
- iLen = iTo - iFrom + 1; /* the +1 is for an actual char, NOT \0! */
- pBufStart = pBuf = MALLOC((iLen + 1) * sizeof(char));
- if(pBuf == NULL) {
- if(*pbMustBeFreed == 1)
- free(pRes);
- RET_OUT_OF_MEMORY;
- }
- pSb = pRes;
- if(iFrom) {
- /* skip to the start of the substring (can't do pointer arithmetic
- * because the whole string might be smaller!!)
- */
- while(*pSb && iFrom) {
- --iFrom;
- ++pSb;
- }
- }
- /* OK, we are at the begin - now let's copy... */
- bufLen = iLen;
- while(*pSb && iLen) {
- *pBuf++ = *pSb;
- ++pSb;
- --iLen;
- }
- *pBuf = '\0';
- bufLen -= iLen; /* subtract remaining length if the string was smaller! */
- if(*pbMustBeFreed == 1)
- free(pRes);
- pRes = pBufStart;
- *pbMustBeFreed = 1;
- }
#ifdef FEATURE_REGEXP
} else {
/* Check for regular expressions */
@@ -3027,6 +2984,60 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
#endif /* #ifdef FEATURE_REGEXP */
}
+ if(pTpe->data.field.iFromPos != 0 || pTpe->data.field.iToPos != 0) {
+ /* we need to obtain a private copy */
+ int iFrom, iTo;
+ uchar *pSb;
+ iFrom = pTpe->data.field.iFromPos;
+ iTo = pTpe->data.field.iToPos;
+ /* need to zero-base to and from (they are 1-based!) */
+ if(iFrom > 0)
+ --iFrom;
+ if(iTo > 0)
+ --iTo;
+ if(bufLen == -1)
+ bufLen = ustrlen(pRes);
+ if(iFrom == 0 && iTo >= bufLen) {
+ /* in this case, the requested string is a superset of what we already have,
+ * so there is no need to do any processing. This is a frequent case for size-limited
+ * fields like TAG in the default forwarding template (so it is a useful optimization
+ * to check for this condition ;)). -- rgerhards, 2009-07-09
+ */
+ ; /*DO NOTHING*/
+ } else {
+ iLen = iTo - iFrom + 1; /* the +1 is for an actual char, NOT \0! */
+ pBufStart = pBuf = MALLOC((iLen + 1) * sizeof(char));
+ if(pBuf == NULL) {
+ if(*pbMustBeFreed == 1)
+ free(pRes);
+ RET_OUT_OF_MEMORY;
+ }
+ pSb = pRes;
+ if(iFrom) {
+ /* skip to the start of the substring (can't do pointer arithmetic
+ * because the whole string might be smaller!!)
+ */
+ while(*pSb && iFrom) {
+ --iFrom;
+ ++pSb;
+ }
+ }
+ /* OK, we are at the begin - now let's copy... */
+ bufLen = iLen;
+ while(*pSb && iLen) {
+ *pBuf++ = *pSb;
+ ++pSb;
+ --iLen;
+ }
+ *pBuf = '\0';
+ bufLen -= iLen; /* subtract remaining length if the string was smaller! */
+ if(*pbMustBeFreed == 1)
+ free(pRes);
+ pRes = pBufStart;
+ *pbMustBeFreed = 1;
+ }
+ }
+
/* now check if we need to do our "SP if first char is non-space" hack logic */
if(*pRes && pTpe->data.field.options.bSPIffNo1stSP) {
/* here, we always destruct the buffer and return a new one */
diff --git a/runtime/obj.c b/runtime/obj.c
index 93fbd281..b2739c58 100644
--- a/runtime/obj.c
+++ b/runtime/obj.c
@@ -96,7 +96,7 @@ DEFobjCurrIf(module)
DEFobjCurrIf(errmsg)
DEFobjCurrIf(strm)
static objInfo_t *arrObjInfo[OBJ_NUM_IDS]; /* array with object information pointers */
-static pthread_mutex_t mutObjGlobalOp; /* mutex to guard global operations of the object system */
+pthread_mutex_t mutObjGlobalOp; /* mutex to guard global operations of the object system */
/* cookies for serialized lines */
@@ -1318,7 +1318,7 @@ objClassInit(modInfo_t *pModInfo)
}
/* the mutex must be recursive, because objects may call into other
- * object identifieres recursively.
+ * object identifiers recursively.
*/
pthread_mutexattr_init(&mutAttr);
pthread_mutexattr_settype(&mutAttr, PTHREAD_MUTEX_RECURSIVE);
diff --git a/runtime/obj.h b/runtime/obj.h
index be97f20e..32f7ef09 100644
--- a/runtime/obj.h
+++ b/runtime/obj.h
@@ -122,4 +122,8 @@ rsRetVal objGetObjInterface(obj_if_t *pIf);
PROTOTYPEObjClassInit(obj);
PROTOTYPEObjClassExit(obj);
+
+/* the following definition is only for "friends" */
+extern pthread_mutex_t mutObjGlobalOp; /* mutex to guard global operations of the object system */
+
#endif /* #ifndef OBJ_H_INCLUDED */
diff --git a/runtime/queue.c b/runtime/queue.c
index 7085c829..a2f80d29 100644
--- a/runtime/queue.c
+++ b/runtime/queue.c
@@ -1801,7 +1801,7 @@ ConsumerReg(qqueue_t *pThis, wti_t *pWti)
}
/* but now cancellation is no longer permitted */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+ pthread_setcancelstate(iCancelStateSave, NULL);
finalize_it:
DBGPRINTF("regular consumer finished, iret=%d, szlog %d sz phys %d\n", iRet,
@@ -1854,7 +1854,7 @@ ConsumerDA(qqueue_t *pThis, wti_t *pWti)
}
/* but now cancellation is no longer permitted */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
+ pthread_setcancelstate(iCancelStateSave, NULL);
/* now we are done, but need to re-aquire the mutex */
d_pthread_mutex_lock(pThis->mut);
@@ -2383,6 +2383,7 @@ static inline rsRetVal
doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr)
{
DEFiRet;
+ int err;
struct timespec t;
STATSCOUNTER_INC(pThis->ctrEnqueued, pThis->mutCtrEnqueued);
@@ -2411,15 +2412,45 @@ doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr)
* It's a side effect, but a good one ;) -- rgerhards, 2008-03-14
*/
if(flowCtlType == eFLOWCTL_FULL_DELAY) {
- while(pThis->iQueueSize >= pThis->iFullDlyMrk) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: FullDelay mark reached for full delayable message - blocking.\n");
- pthread_cond_wait(&pThis->belowFullDlyWtrMrk, pThis->mut); /* TODO error check? But what do then? */
+ while(pThis->iQueueSize >= pThis->iFullDlyMrk&& ! glbl.GetGlobalInputTermState()) {
+ /* We have a problem during shutdown if we block eternally. In that
+ * case, the the input thread cannot be terminated. So we wake up
+ * from time to time to check for termination.
+ * TODO/v6(at earliest): check if we could signal the condition during
+ * shutdown. However, this requires new queue registries and thus is
+ * far to much change for a stable version (and I am still not sure it
+ * is worth the effort, given how seldom this situation occurs and how
+ * few resources the wakeups need). -- rgerhards, 2012-05-03
+ * In any case, this was the old code (if we do the TODO):
+ * pthread_cond_wait(&pThis->belowFullDlyWtrMrk, pThis->mut);
+ */
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: FullDelay mark reached for full delayable message "
+ "- blocking, queue size is %d.\n", pThis->iQueueSize);
+ timeoutComp(&t, 1000);
+ err = pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t);
+ if(err != 0 && err != ETIMEDOUT) {
+ /* Something is really wrong now. Report to debug log and abort the
+ * wait. That keeps us running, even though we may lose messages.
+ */
+ DBGOPRINT((obj_t*) pThis, "potential program bug: pthread_cond_timedwait()"
+ "/fulldelay returned %d\n", err);
+ break;
+
+ }
+ DBGPRINTF("wti worker in full delay timed out, checking termination...\n");
}
- } else if(flowCtlType == eFLOWCTL_LIGHT_DELAY) {
+ } else if(flowCtlType == eFLOWCTL_LIGHT_DELAY && !glbl.GetGlobalInputTermState()) {
if(pThis->iQueueSize >= pThis->iLightDlyMrk) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: LightDelay mark reached for light delayable message - blocking a bit.\n");
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: LightDelay mark reached for light "
+ "delayable message - blocking a bit.\n");
timeoutComp(&t, 1000); /* 1000 millisconds = 1 second TODO: make configurable */
- pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t); /* TODO error check? But what do then? */
+ err = pthread_cond_timedwait(&pThis->belowLightDlyWtrMrk, pThis->mut, &t);
+ if(err != 0 && err != ETIMEDOUT) {
+ /* Something is really wrong now. Report to debug log */
+ DBGOPRINT((obj_t*) pThis, "potential program bug: pthread_cond_timedwait()"
+ "/lightdelay returned %d\n", err);
+
+ }
}
}
@@ -2431,17 +2462,27 @@ doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr)
while( (pThis->iMaxQueueSize > 0 && pThis->iQueueSize >= pThis->iMaxQueueSize)
|| (pThis->qType == QUEUETYPE_DISK && pThis->sizeOnDiskMax != 0
&& pThis->tVars.disk.sizeOnDisk > pThis->sizeOnDiskMax)) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: queue FULL - waiting to drain.\n");
- timeoutComp(&t, pThis->toEnq);
STATSCOUNTER_INC(pThis->ctrFull, pThis->mutCtrFull);
-// TODO : handle enqOnly => discard!
- if(pthread_cond_timedwait(&pThis->notFull, pThis->mut, &t) != 0) {
- DBGOPRINT((obj_t*) pThis, "enqueueMsg: cond timeout, dropping message!\n");
+ if(pThis->toEnq == 0 || pThis->bEnqOnly) {
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: queue FULL - configured for immediate discarding.\n");
STATSCOUNTER_INC(pThis->ctrFDscrd, pThis->mutCtrFDscrd);
objDestruct(pUsr);
ABORT_FINALIZE(RS_RET_QUEUE_FULL);
- }
+ } else {
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: queue FULL - waiting %dms to drain.\n", pThis->toEnq);
+ if(glbl.GetGlobalInputTermState()) {
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: queue FULL, discard due to FORCE_TERM.\n");
+ ABORT_FINALIZE(RS_RET_FORCE_TERM);
+ }
+ timeoutComp(&t, pThis->toEnq);
+ if(pthread_cond_timedwait(&pThis->notFull, pThis->mut, &t) != 0) {
+ DBGOPRINT((obj_t*) pThis, "enqueueMsg: cond timeout, dropping message!\n");
+ STATSCOUNTER_INC(pThis->ctrFDscrd, pThis->mutCtrFDscrd);
+ objDestruct(pUsr);
+ ABORT_FINALIZE(RS_RET_QUEUE_FULL);
+ }
dbgoprint((obj_t*) pThis, "enqueueMsg: wait solved queue full condition, enqueing\n");
+ }
}
/* and finally enqueue the message */
diff --git a/runtime/rsconf.c b/runtime/rsconf.c
index ff9e1291..16929b71 100644
--- a/runtime/rsconf.c
+++ b/runtime/rsconf.c
@@ -432,6 +432,7 @@ void cnfDoCfsysline(char *ln)
DBGPRINTF("cnf:global:cfsysline: %s\n", ln);
/* the legacy system needs the "$" stripped */
conf.cfsysline((uchar*) ln+1);
+ free(ln);
}
void cnfDoBSDTag(char *ln)
@@ -688,7 +689,8 @@ runInputModules(void)
DBGPRINTF("running module %s with config %p\n", node->pMod->pszName, node);
bNeedsCancel = (node->pMod->isCompatibleWithFeature(sFEATURENonCancelInputTermination) == RS_RET_OK) ?
0 : 1;
- thrdCreate(node->pMod->mod.im.runInput, node->pMod->mod.im.afterRun, bNeedsCancel);
+ thrdCreate(node->pMod->mod.im.runInput, node->pMod->mod.im.afterRun, bNeedsCancel,
+ (node->pMod->cnfName == NULL) ? node->pMod->pszName : node->pMod->cnfName);
}
node = module.GetNxtCnfType(runConf, node, eMOD_IN);
}
diff --git a/runtime/srUtils.h b/runtime/srUtils.h
index 76d25eb2..3169fd94 100644
--- a/runtime/srUtils.h
+++ b/runtime/srUtils.h
@@ -93,19 +93,6 @@ int getSubString(uchar **ppSrc, char *pDst, size_t DstSize, char cSep);
rsRetVal getFileSize(uchar *pszName, off_t *pSize);
/* mutex operations */
-/* some macros to cancel-safe lock a mutex (it will automatically be released
- * when the thread is cancelled. This needs to be done as macros because
- * pthread_cleanup_push sometimes is a macro that can not be used inside a function.
- * It's a bit ugly, but works well... rgerhards, 2008-01-20
- */
-#define DEFVARS_mutex_cancelsafeLock int iCancelStateSave
-#define mutex_cancelsafe_lock(mut) \
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave); \
- d_pthread_mutex_lock(mut); \
- pthread_cleanup_push(mutexCancelCleanup, mut); \
- pthread_setcancelstate(iCancelStateSave, NULL);
-#define mutex_cancelsafe_unlock(mut) pthread_cleanup_pop(1)
-
/* some useful constants */
#define DEFVARS_mutexProtection\
int bLockedOpIsLocked=0
diff --git a/tcpsrv.c b/tcpsrv.c
index b5b64f07..0e6e13d2 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -97,6 +97,7 @@ DEFobjCurrIf(nspoll)
DEFobjCurrIf(prop)
DEFobjCurrIf(statsobj)
+static void startWorkerPool(void);
/* The following structure controls the worker threads. Global data is
* needed for their access.
@@ -108,8 +109,10 @@ static struct wrkrInfo_s {
tcpsrv_t *pSrv; /* pSrv == NULL -> idle */
nspoll_t *pPoll;
void *pUsr;
+ sbool enabled;
long long unsigned numCalled; /* how often was this called */
} wrkrInfo[4];
+static sbool bWrkrRunning; /* are the worker threads running? */
static pthread_mutex_t wrkrMut;
static pthread_cond_t wrkrIdle;
static int wrkrMax = 4;
@@ -625,8 +628,10 @@ wrkr(void *myself)
while(me->pSrv == NULL && glbl.GetGlobalInputTermState() == 0) {
pthread_cond_wait(&me->run, &wrkrMut);
}
- if(glbl.GetGlobalInputTermState() == 1)
+ if(glbl.GetGlobalInputTermState() == 1) {
+ --wrkrRunning;
break;
+ }
pthread_mutex_unlock(&wrkrMut);
++me->numCalled;
@@ -637,6 +642,7 @@ wrkr(void *myself)
--wrkrRunning;
pthread_cond_signal(&wrkrIdle);
}
+ me->enabled = 0; /* indicate we are no longer available */
pthread_mutex_unlock(&wrkrMut);
return NULL;
@@ -666,7 +672,7 @@ processWorkset(tcpsrv_t *pThis, nspoll_t *pPoll, int numEntries, nsd_epworkset_t
} else {
pthread_mutex_lock(&wrkrMut);
/* check if there is a free worker */
- for(i = 0 ; (i < wrkrMax) && (wrkrInfo[i].pSrv != NULL) ; ++i)
+ for(i = 0 ; (i < wrkrMax) && ((wrkrInfo[i].pSrv != NULL) || (wrkrInfo[i].enabled == 0)) ; ++i)
/*do search*/;
if(i < wrkrMax) {
/* worker free -> use it! */
@@ -836,6 +842,16 @@ Run(tcpsrv_t *pThis)
ISOBJ_TYPE_assert(pThis, tcpsrv);
+ /* check if we need to start the worker pool. Once it is running, all is
+ * well. Shutdown is done on modExit.
+ */
+ d_pthread_mutex_lock(&wrkrMut);
+ if(!bWrkrRunning) {
+ bWrkrRunning = 1;
+ startWorkerPool();
+ }
+ d_pthread_mutex_unlock(&wrkrMut);
+
/* this is an endless loop - it is terminated by the framework canelling
* this thread. Thus, we also need to instantiate a cancel cleanup handler
* to prevent us from leaking anything. -- rgerhards, 20080-04-24
@@ -1306,28 +1322,42 @@ BEGINObjClassInit(tcpsrv, 1, OBJ_IS_LOADABLE_MODULE) /* class, version - CHANGE
ENDObjClassInit(tcpsrv)
-/* destroy worker pool structures and wait for workers to terminate
+/* start worker threads
+ * Important: if we fork, this MUST be done AFTER forking
*/
-static inline void
+static void
startWorkerPool(void)
{
int i;
+ int r;
+ pthread_attr_t sessThrdAttr;
+
wrkrRunning = 0;
- pthread_mutex_init(&wrkrMut, NULL);
pthread_cond_init(&wrkrIdle, NULL);
+ pthread_attr_init(&sessThrdAttr);
+ pthread_attr_setstacksize(&sessThrdAttr, 200*1024);
for(i = 0 ; i < wrkrMax ; ++i) {
/* init worker info structure! */
pthread_cond_init(&wrkrInfo[i].run, NULL);
wrkrInfo[i].pSrv = NULL;
wrkrInfo[i].numCalled = 0;
- pthread_create(&wrkrInfo[i].tid, NULL, wrkr, &(wrkrInfo[i]));
+ r = pthread_create(&wrkrInfo[i].tid, &sessThrdAttr, wrkr, &(wrkrInfo[i]));
+ if(r == 0) {
+ wrkrInfo[i].enabled = 1;
+ } else {
+ char errStr[1024];
+ wrkrInfo[i].enabled = 0;
+ rs_strerror_r(errno, errStr, sizeof(errStr));
+ errmsg.LogError(0, NO_ERRCODE, "tcpsrv error creating thread %d: "
+ "%s", i, errStr);
+ }
}
-
+ pthread_attr_destroy(&sessThrdAttr);
}
/* destroy worker pool structures and wait for workers to terminate
*/
-static inline void
+static void
stopWorkerPool(void)
{
int i;
@@ -1347,9 +1377,7 @@ stopWorkerPool(void)
BEGINmodExit
CODESTARTmodExit
-dbgprintf("tcpsrv: modExit\n");
stopWorkerPool();
-
/* de-init in reverse order! */
tcpsrvClassExit();
tcps_sessClassExit();
@@ -1365,13 +1393,24 @@ ENDqueryEtryPt
BEGINmodInit()
CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
+ /* we just init the worker mutex, but do not start the workers themselves. This is deferred
+ * to the first call of Run(). Reasons for this:
+ * 1. depending on load order, tcpsrv gets loaded during rsyslog startup BEFORE
+ * it forks, in which case the workers would be running in the then-killed parent,
+ * leading to a defuncnt child (we actually had this bug).
+ * 2. depending on circumstances, Run() would possibly never be called, in which case
+ * the worker threads would be totally useless.
+ * Note that in order to guarantee a non-racy worker start, we need to guard the
+ * startup sequence by a mutex, which is why we init it here (no problem with fork()
+ * in this case as the mutex is a pure-memory structure).
+ * rgerhards, 2012-05-18
+ */
+ pthread_mutex_init(&wrkrMut, NULL);
+ bWrkrRunning = 0;
/* Initialize all classes that are in our module - this includes ourselfs */
CHKiRet(tcps_sessClassInit(pModInfo));
CHKiRet(tcpsrvClassInit(pModInfo)); /* must be done after tcps_sess, as we use it */
-
- startWorkerPool();
-
ENDmodInit
/* vim:set ai:
diff --git a/template.c b/template.c
index c6878459..994a9029 100644
--- a/template.c
+++ b/template.c
@@ -753,6 +753,13 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
pTpe->data.field.field_expand = 1;
p ++;
}
+ if(*p == ',') { /* real fromPos? */
+ ++p;
+ iNum = 0;
+ while(isdigit((int)*p))
+ iNum = iNum * 10 + *p++ - '0';
+ pTpe->data.field.iFromPos = iNum;
+ }
}
}
} else {
@@ -853,10 +860,24 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* fallthrough to "regular" ToPos code */
#endif /* #ifdef FEATURE_REGEXP */
- iNum = 0;
- while(isdigit((int)*p))
- iNum = iNum * 10 + *p++ - '0';
- pTpe->data.field.iToPos = iNum;
+ if(pTpe->data.field.has_fields == 1) {
+ iNum = 0;
+ while(isdigit((int)*p))
+ iNum = iNum * 10 + *p++ - '0';
+ pTpe->data.field.iFieldNr = iNum;
+ if(*p == ',') { /* get real toPos? */
+ ++p;
+ iNum = 0;
+ while(isdigit((int)*p))
+ iNum = iNum * 10 + *p++ - '0';
+ pTpe->data.field.iToPos = iNum;
+ }
+ } else {
+ iNum = 0;
+ while(isdigit((int)*p))
+ iNum = iNum * 10 + *p++ - '0';
+ pTpe->data.field.iToPos = iNum;
+ }
/* skip to next known good */
while(*p && *p != '%' && *p != ':') {
/* TODO: complain on extra characters */
@@ -868,7 +889,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
#endif /* #ifdef FEATURE_REGEXP */
}
- if((pTpe->data.field.has_fields == 0) && (pTpe->data.field.iToPos < pTpe->data.field.iFromPos)) {
+ if(pTpe->data.field.iToPos < pTpe->data.field.iFromPos) {
iNum = pTpe->data.field.iToPos;
pTpe->data.field.iToPos = pTpe->data.field.iFromPos;
pTpe->data.field.iFromPos = iNum;
@@ -922,14 +943,13 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
static rsRetVal
tplAddTplMod(struct template *pTpl, uchar** ppRestOfConfLine)
{
- uchar *pSrc, *pDst;
+ uchar *pSrc;
uchar szMod[2048];
unsigned lenMod;
strgen_t *pStrgen;
DEFiRet;
pSrc = *ppRestOfConfLine;
- pDst = szMod;
lenMod = 0;
while(*pSrc && !isspace(*pSrc) && lenMod < sizeof(szMod) - 1) {
szMod[lenMod] = *pSrc++;
@@ -1342,9 +1362,9 @@ void tplPrintList(rsconf_t *conf)
}
if(pTpe->data.field.has_fields == 1) {
dbgprintf("[substring, field #%d only (delemiter %d)] ",
- pTpe->data.field.iToPos, pTpe->data.field.field_delim);
- } else if(pTpe->data.field.iFromPos != 0 ||
- pTpe->data.field.iToPos != 0) {
+ pTpe->data.field.iFieldNr, pTpe->data.field.field_delim);
+ }
+ if(pTpe->data.field.iFromPos != 0 || pTpe->data.field.iToPos != 0) {
dbgprintf("[substring, from character %d to %d] ",
pTpe->data.field.iFromPos,
pTpe->data.field.iToPos);
diff --git a/template.h b/template.h
index f55f64b3..e41823e9 100644
--- a/template.h
+++ b/template.h
@@ -69,6 +69,7 @@ struct templateEntry {
propid_t propid; /* property to be used */
unsigned iFromPos; /* for partial strings only chars from this position ... */
unsigned iToPos; /* up to that one... */
+ unsigned iFieldNr; /* for field extraction: field to extract */
#ifdef FEATURE_REGEXP
regex_t re; /* APR: this is the regular expression */
short has_regex;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 50ce2e0b..aff44eef 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -65,7 +65,6 @@ TESTS += \
failover-no-basic.sh \
rcvr_fail_restore.sh \
linkedlistqueue.sh
-endif
if HAVE_VALGRIND
TESTS += \
@@ -76,7 +75,8 @@ TESTS += \
failover-no-basic-vg.sh \
failover-no-rptd-vg.sh \
tcp-msgreduc-vg.sh
-endif
+endif # HAVE_VALGRIND
+endif # ENABLE_IMDIAG
if ENABLE_MYSQL_TESTS
diff --git a/tests/imuxsock_ccmiddle_root.sh b/tests/imuxsock_ccmiddle_root.sh
index b487611a..7f255bd0 100755
--- a/tests/imuxsock_ccmiddle_root.sh
+++ b/tests/imuxsock_ccmiddle_root.sh
@@ -2,6 +2,9 @@
# carry out this test
echo \[imuxsock_ccmiddle_root.sh\]: test trailing LF handling in imuxsock
echo This test must be run as root with no other active syslogd
+if [ "$EUID" -ne 0 ]; then
+ exit 77 # Not root, skip this test
+fi
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imuxsock_ccmiddle_root.conf
# send a message with trailing LF
diff --git a/tests/imuxsock_logger_root.sh b/tests/imuxsock_logger_root.sh
index 377999f7..0902d797 100755
--- a/tests/imuxsock_logger_root.sh
+++ b/tests/imuxsock_logger_root.sh
@@ -2,6 +2,9 @@
# carry out this test.
echo \[imuxsock_logger_root.sh\]: test trailing LF handling in imuxsock
echo This test must be run as root with no other active syslogd
+if [ "$EUID" -ne 0 ]; then
+ exit 77 # Not root, skip this test
+fi
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imuxsock_logger_root.conf
# send a message with trailing LF
diff --git a/tests/imuxsock_traillf_root.sh b/tests/imuxsock_traillf_root.sh
index 1b821ee7..0141a626 100755
--- a/tests/imuxsock_traillf_root.sh
+++ b/tests/imuxsock_traillf_root.sh
@@ -2,6 +2,9 @@
# carry out this test
echo \[imuxsock_traillf_root.sh\]: test trailing LF handling in imuxsock
echo This test must be run as root with no other active syslogd
+if [ "$EUID" -ne 0 ]; then
+ exit 77 # Not root, skip this test
+fi
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imuxsock_traillf_root.conf
# send a message with trailing LF
diff --git a/tests/sndrcv_udp.sh b/tests/sndrcv_udp.sh
index 274a414a..df37782c 100755
--- a/tests/sndrcv_udp.sh
+++ b/tests/sndrcv_udp.sh
@@ -7,4 +7,7 @@
# This file is part of the rsyslog project, released under GPLv3
echo ===============================================================================
echo \[sndrcv_udp.sh\]: testing sending and receiving via udp
+if [ "$EUID" -ne 0 ]; then
+ exit 77 # Not root, skip this test
+fi
source $srcdir/sndrcv_drvr.sh sndrcv_udp 50
diff --git a/tests/tcpflood.c b/tests/tcpflood.c
index 8a34f06f..f3a89c77 100644
--- a/tests/tcpflood.c
+++ b/tests/tcpflood.c
@@ -348,7 +348,7 @@ genMsg(char *buf, size_t maxBuf, int *pLenBuf, struct instdata *inst)
do {
done = 1;
*pLenBuf = fread(buf, 1, 1024, dataFP);
- if(feof(dataFP)) {
+ if(*pLenBuf == 0) {
if(--numFileIterations > 0) {
rewind(dataFP);
done = 0; /* need new iteration */
@@ -662,7 +662,7 @@ runTests(void)
int run;
stats.totalRuntime = 0;
- stats.minRuntime = (unsigned long long) 0xffffffffffffffffll;
+ stats.minRuntime = 0xffffffffllu;
stats.maxRuntime = 0;
stats.numRuns = numRuns;
run = 1;
diff --git a/threads.c b/threads.c
index 1aca6dbc..16de5631 100644
--- a/threads.c
+++ b/threads.c
@@ -31,12 +31,16 @@
#include <errno.h>
#include <pthread.h>
#include <assert.h>
+#if HAVE_SYS_PRCTL_H
+# include <sys/prctl.h>
+#endif
#include "rsyslog.h"
#include "dirty.h"
#include "linkedlist.h"
#include "threads.h"
#include "srUtils.h"
+#include "unicode-helper.h"
/* linked list of currently-known threads */
static linkedList_t llThrds;
@@ -77,6 +81,7 @@ static rsRetVal thrdDestruct(thrdInfo_t *pThis)
}
pthread_mutex_destroy(&pThis->mutThrd);
pthread_cond_destroy(&pThis->condThrdTerm);
+ free(pThis->name);
free(pThis);
RETiRet;
@@ -95,7 +100,8 @@ thrdTerminateNonCancel(thrdInfo_t *pThis)
DEFiRet;
assert(pThis != NULL);
- DBGPRINTF("request term via SIGTTIN for input thread 0x%x\n", (unsigned) pThis->thrdID);
+ DBGPRINTF("request term via SIGTTIN for input thread '%s' 0x%x\n",
+ pThis->name, (unsigned) pThis->thrdID);
pThis->bShallStop = TRUE;
do {
d_pthread_mutex_lock(&pThis->mutThrd);
@@ -105,11 +111,11 @@ thrdTerminateNonCancel(thrdInfo_t *pThis)
d_pthread_mutex_unlock(&pThis->mutThrd);
if(Debug) {
if(ret == ETIMEDOUT) {
- dbgprintf("input thread term: timeout expired waiting on thread termination - canceling\n");
+ dbgprintf("input thread term: timeout expired waiting on thread %s termination - canceling\n", pThis->name);
pthread_cancel(pThis->thrdID);
pThis->bIsActive = 0;
} else if(ret == 0) {
- dbgprintf("input thread term: thread returned normally and is terminated\n");
+ dbgprintf("input thread term: thread %s returned normally and is terminated\n", pThis->name);
} else {
char errStr[1024];
int err = errno;
@@ -119,7 +125,8 @@ thrdTerminateNonCancel(thrdInfo_t *pThis)
}
}
} while(pThis->bIsActive);
- DBGPRINTF("non-cancel input thread termination succeeded for thread 0x%x\n", (unsigned) pThis->thrdID);
+ DBGPRINTF("non-cancel input thread termination succeeded for thread %s 0x%x\n",
+ pThis->name, (unsigned) pThis->thrdID);
RETiRet;
}
@@ -169,10 +176,23 @@ static void* thrdStarter(void *arg)
{
DEFiRet;
thrdInfo_t *pThis = (thrdInfo_t*) arg;
+# if HAVE_PRCTL && defined PR_SET_NAME
+ uchar thrdName[32] = "in:";
+# endif
assert(pThis != NULL);
assert(pThis->pUsrThrdMain != NULL);
+# if HAVE_PRCTL && defined PR_SET_NAME
+ /* set thread name - we ignore if the call fails, has no harsh consequences... */
+ ustrncpy(thrdName+3, pThis->name, 20);
+ if(prctl(PR_SET_NAME, thrdName, 0, 0, 0) != 0) {
+ DBGPRINTF("prctl failed, not setting thread name for '%s'\n", pThis->name);
+ } else {
+ DBGPRINTF("set thread name to '%s'\n", thrdName);
+ }
+# endif
+
/* block all signals */
sigset_t sigSet;
sigfillset(&sigSet);
@@ -189,7 +209,8 @@ static void* thrdStarter(void *arg)
*/
iRet = pThis->pUsrThrdMain(pThis);
- dbgprintf("thrdStarter: usrThrdMain 0x%lx returned with iRet %d, exiting now.\n", (unsigned long) pThis->thrdID, iRet);
+ dbgprintf("thrdStarter: usrThrdMain %s - 0x%lx returned with iRet %d, exiting now.\n",
+ pThis->name, (unsigned long) pThis->thrdID, iRet);
/* signal master control that we exit (we do the mutex lock mostly to
* keep the thread debugger happer, it would not really be necessary with
@@ -208,7 +229,7 @@ static void* thrdStarter(void *arg)
* executing threads. It is added at the end of the list.
* rgerhards, 2007-12-14
*/
-rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *), sbool bNeedsCancel)
+rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *), sbool bNeedsCancel, uchar *name)
{
DEFiRet;
thrdInfo_t *pThis;
@@ -220,6 +241,7 @@ rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdI
pThis->pUsrThrdMain = thrdMain;
pThis->pAfterRun = afterRun;
pThis->bNeedsCancel = bNeedsCancel;
+ pThis->name = ustrdup(name);
pthread_create(&pThis->thrdID,
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
&default_thread_attr,
diff --git a/threads.h b/threads.h
index d838bde2..1ee767a2 100644
--- a/threads.h
+++ b/threads.h
@@ -32,6 +32,7 @@ struct thrdInfo {
rsRetVal (*pAfterRun)(struct thrdInfo*); /* cleanup function */
pthread_t thrdID;
sbool bNeedsCancel; /* must input be terminated by pthread_cancel()? */
+ uchar *name; /* a thread name, mainly for user interaction */
};
/* prototypes */
@@ -39,7 +40,7 @@ rsRetVal thrdExit(void);
rsRetVal thrdInit(void);
rsRetVal thrdTerminate(thrdInfo_t *pThis);
rsRetVal thrdTerminateAll(void);
-rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *), sbool);
+rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *), sbool, uchar*);
/* macros (replace inline functions) */
diff --git a/tools/omfile.c b/tools/omfile.c
index de3cb4f6..90b452bf 100644
--- a/tools/omfile.c
+++ b/tools/omfile.c
@@ -838,7 +838,7 @@ CODESTARTnewActInst
}
CHKiRet(OMSRsetEntry(*ppOMSR, 0, ustrdup((pData->tplName == NULL) ?
- (uchar*)"RSYSLOG_FileFormat" : (uchar*)"??"),
+ (uchar*)"RSYSLOG_FileFormat" : pData->tplName),
OMSR_NO_RQD_TPL_OPTS));
if(pData->bDynamicName) {
diff --git a/tools/pmrfc3164.c b/tools/pmrfc3164.c
index 6d2d22b1..2657780d 100644
--- a/tools/pmrfc3164.c
+++ b/tools/pmrfc3164.c
@@ -75,7 +75,6 @@ ENDisCompatibleWithFeature
BEGINparse
uchar *p2parse;
int lenMsg;
- int bTAGCharDetected;
int i; /* general index for parsing */
uchar bufParseTAG[CONF_TAG_MAXSIZE];
uchar bufParseHOSTNAME[CONF_HOSTNAME_MAXSIZE];
@@ -137,7 +136,6 @@ CODESTARTparse
* rgerhards, 2009-06-23: and I now have extended this logic to every character
* that is not a valid hostname.
*/
- bTAGCharDetected = 0;
if(lenMsg > 0 && pMsg->msgFlags & PARSE_HOSTNAME) {
i = 0;
while(i < lenMsg && (isalnum(p2parse[i]) || p2parse[i] == '.' || p2parse[i] == '.'
diff --git a/tools/pmrfc5424.c b/tools/pmrfc5424.c
index b06f1347..9b5c6165 100644
--- a/tools/pmrfc5424.c
+++ b/tools/pmrfc5424.c
@@ -106,7 +106,7 @@ static int parseRFCField(uchar **pp2parse, uchar *pResult, int *pLenStr)
/* set the new parse pointer */
*pp2parse = p2parse;
- return 0;
+ return iRet;
}
@@ -191,7 +191,7 @@ static int parseRFCStructuredData(uchar **pp2parse, uchar *pResult, int *pLenStr
/* set the new parse pointer */
*pp2parse = p2parse;
*pLenStr = lenStr;
- return 0;
+ return iRet;
}
/* parse a RFC5424-formatted syslog message. This function returns
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 04379dfb..44e60b1c 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -849,6 +849,11 @@ die(int sig)
errno = 0;
logmsgInternal(NO_ERRCODE, LOG_SYSLOG|LOG_INFO, (uchar*)buf, 0);
}
+ /* we sleep for 50ms to give the queue a chance to pick up the exit message;
+ * otherwise we have seen cases where the message did not make it to log
+ * files, even on idle systems.
+ */
+ srSleep(0, 50);
/* drain queue (if configured so) and stop main queue worker thread pool */
DBGPRINTF("Terminating main queue...\n");
@@ -1663,7 +1668,7 @@ doGlblProcessInit(void)
if( !(Debug == DEBUG_FULL || NoFork) )
{
- DBGPRINTF("Checking pidfile.\n");
+ DBGPRINTF("Checking pidfile '%s'.\n", PidFile);
if (!check_pid(PidFile))
{
memset(&sigAct, 0, sizeof (sigAct));
@@ -1671,6 +1676,9 @@ doGlblProcessInit(void)
sigAct.sa_handler = doexit;
sigaction(SIGTERM, &sigAct, NULL);
+ /* stop writing debug messages to stdout (if debugging is on) */
+ stddbg = -1;
+
if (fork()) {
/* Parent process
*/
@@ -1733,7 +1741,7 @@ doGlblProcessInit(void)
}
/* tuck my process id away */
- DBGPRINTF("Writing pidfile %s.\n", PidFile);
+ DBGPRINTF("Writing pidfile '%s'.\n", PidFile);
if (!check_pid(PidFile))
{
if (!write_pid(PidFile))
@@ -1781,7 +1789,6 @@ doGlblProcessInit(void)
int realMain(int argc, char **argv)
{
rsRetVal localRet;
- register uchar *p;
int ch;
extern int optind;
extern char *optarg;