summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog51
-rw-r--r--action.c34
-rw-r--r--action.h1
-rw-r--r--configure.ac62
-rw-r--r--doc/imklog.html66
-rw-r--r--doc/manual.html2
-rw-r--r--plugins/imklog/bsd.c29
-rw-r--r--plugins/imklog/imklog.c5
-rw-r--r--plugins/imklog/imklog.h1
-rw-r--r--plugins/imklog/solaris_cddl.c2
-rw-r--r--plugins/imudp/imudp.c4
-rw-r--r--plugins/imuxsock/Makefile.am2
-rw-r--r--plugins/imuxsock/imuxsock.c5
-rw-r--r--plugins/ommongodb/ommongodb.c10
-rw-r--r--rsyslog.service.in3
-rw-r--r--runtime/msg.c96
-rw-r--r--runtime/msg.h2
-rw-r--r--runtime/nsdpoll_ptcp.c4
-rw-r--r--runtime/ruleset.c3
-rw-r--r--template.c71
-rw-r--r--template.h8
-rw-r--r--tools/Makefile.am4
-rw-r--r--tools/rsyslogd.828
-rw-r--r--tools/syslogd.c19
24 files changed, 282 insertions, 230 deletions
diff --git a/ChangeLog b/ChangeLog
index c043fea5..9081f07d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,20 +1,25 @@
---------------------------------------------------------------------------
-Version 7.3.1 [devel] 2012-10-??
-- bugfix: imuxsock truncated head of received message
- This happened only under some circumstances. Thanks to Marius
- Tomaschwesky, Florian Piekert and Milan Bartos for their help in
- solving this issue.
+Version 7.3.2 [devel] 2012-10-??
- imtcp: support for Linux-Type ratelimiting added
- imptcp: support for Linux-Type ratelimiting added
- imudp enhancements:
* support for input batching added (performance improvement)
* support for Linux-Type ratelimiting added
+---------------------------------------------------------------------------
+Version 7.3.1 [devel] 2012-10-19
+- optimized template processing performance, especially for $NOW family
+ of properties
- change lumberjack cookie to "@cee:" from "@cee: "
CEE originally specified the cookie with SP, whereas other lumberjack
tools used it without space. In order to keep interop with lumberjack,
we now use the cookie without space as well. I hope this can be changed
in CEE as well when it is released at a later time.
Thanks to Miloslav Trmač for pointing this out and a similiar v7 patch.
+- bugfix: imuxsock and imklog truncated head of received message
+ This happened only under some circumstances. Thanks to Marius
+ Tomaschwesky, Florian Piekert and Milan Bartos for their help in
+ solving this issue.
+- bugfix: imuxsock did not properly honor $LocalHostIPIF
---------------------------------------------------------------------------
Version 7.3.0 [devel] 2012-10-09
- omlibdbi improvements, added
@@ -26,7 +31,24 @@ Version 7.3.0 [devel] 2012-10-09
- improved omfile zip writer to increase compression
This was achieved by somewhat reducing the robustness of the zip archive.
This is controlled by the new action parameter "VeryReliableZip".
- ---------------------------------------------------------------------------
+---------------------------------------------------------------------------
+Version 7.1.13 [beta] 2012-10-??
+- bugfix: imuxsock did not properly honor $LocalHostIPIF
+----------------------------------------------------------------------------
+Version 7.1.12 [beta] 2012-10-18
+- minor updates to better support newer systemd developments
+ Thanks to Michael Biebl for the patches.
+- build system cleanup
+ Thanks to Michael Biebl for the patch series.
+- cleanup: removed remains of -c option (compatibility mode)
+ both from code & doc and emitted warning message if still used
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=361
+ Thanks to Michael Biebl for reporting & suggestions
+- bugfix: imklog truncated head of received message
+ This happened only under some circumstances. Thanks to Marius
+ Tomaschwesky and Florian Piekert for their help in solving this issue.
+----------------------------------------------------------------------------
+>>>>>>> b151584d0929759284c0fb0399709e5ca0e29d60
Version 7.1.11 [beta] 2012-10-16
- bugfix: imuxsock truncated head of received message
This happened only under some circumstances. Thanks to Marius
@@ -42,7 +64,7 @@ Version 7.1.11 [beta] 2012-10-16
Thanks to Miloslav Trmač for pointing this out and a similiar v7 patch.
- added deprecated note to omruleset (plus clue to use "call")
- added deprecated note to discard action (plus clue to use "stop")
- ---------------------------------------------------------------------------
+---------------------------------------------------------------------------
Version 7.1.10 [beta] 2012-10-11
- bugfix: m4 directory was not present in release tarball
- bugfix: small memory leak with string-type templates
@@ -50,7 +72,7 @@ Version 7.1.10 [beta] 2012-10-11
- bugfix: some config processing warning messages were treated as errors
- bugfix: small memory leak when processing action() statements
- bugfix: unknown action() parameters were not reported
- ---------------------------------------------------------------------------
+---------------------------------------------------------------------------
Version 7.1.9 [beta] 2012-10-09
- bugfix: comments inside objects (e.g. action()) were not properly handled
- bugfix: in (non)equal comparisons the position of arrays influenced result
@@ -160,8 +182,6 @@ Version 6.5.1 [devel] 2012-08-??
- added pure JSON output plugin parameter passing mode
- ommongodb now supports templates
- bugfix: imtcp could abort on exit due to invalid free()
-- bugfix: remove invalid socket option call from imuxsock
- Thanks to Cristian Ionescu-Idbohrn and Jonny Törnbom
- bugfix: missing support for escape sequences in RainerScript
only \' was supported. Now the usual set is supported. Note that v5
used \x as escape where x was any character (e.g. "\n" meant "n" and NOT
@@ -200,7 +220,11 @@ Version 6.5.0 [devel] 2012-08-28
http://bugzilla.adiscon.com/show_bug.cgi?id=353
---------------------------------------------------------------------------
Version 6.4.3 [V6-STABLE] 2012-??-??
-- bugfix: imuxsock truncated head of received message
+- cleanup: removed remains of -c option (compatibility mode)
+ both from code & doc and emitted warning message if still used
+ closes: http://bugzilla.adiscon.com/show_bug.cgi?id=361
+ Thanks to Michael Biebl for reporting & suggestions
+- bugfix: imuxsock and imklog truncated head of received message
This happened only under some circumstances. Thanks to Marius
Tomaschwesky, Florian Piekert and Milan Bartos for their help in
solving this issue.
@@ -218,6 +242,7 @@ Version 6.4.3 [V6-STABLE] 2012-??-??
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=358
This happend to filters of the style "local0,local1.*", where the
multiple facilities were comma-separated.
+- bugfix: imuxsock did not properly honor $LocalHostIPIF
---------------------------------------------------------------------------
Version 6.4.2 [V6-STABLE] 2012-09-20
- bugfix: potential abort, if action queue could not be properly started
@@ -784,8 +809,8 @@ expected that interfaces, even new ones, break during the initial
syslog plain tcp input plugin (NOT supporting TLS!)
[ported from v4]
---------------------------------------------------------------------------
-Version 5.10.1 [V5-STABLE], 2012-0?-??
-- bugfix: imuxsock truncated head of received message
+Version 5.10.1 [V5-STABLE], 2012-10-17
+- bugfix: imuxsock and imklog truncated head of received message
This happened only under some circumstances. Thanks to Marius
Tomaschwesky, Florian Piekert and Milan Bartos for their help in
solving this issue.
diff --git a/action.c b/action.c
index 9c06f61e..cf010d01 100644
--- a/action.c
+++ b/action.c
@@ -809,7 +809,8 @@ rsRetVal actionDbgPrint(action_t *pThis)
/* prepare the calling parameters for doAction()
* rgerhards, 2009-05-07
*/
-static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem)
+static rsRetVal
+prepareDoActionParams(action_t *pAction, batch_obj_t *pElem, struct syslogTime *ttNow)
{
int i;
msg_t *pMsg;
@@ -825,17 +826,17 @@ static rsRetVal prepareDoActionParams(action_t *pAction, batch_obj_t *pElem)
switch(pAction->eParamPassing) {
case ACT_STRING_PASSING:
CHKiRet(tplToString(pAction->ppTpl[i], pMsg, &(pElem->staticActStrings[i]),
- &pElem->staticLenStrings[i]));
+ &pElem->staticLenStrings[i], ttNow));
pElem->staticActParams[i] = pElem->staticActStrings[i];
break;
case ACT_ARRAY_PASSING:
- CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(pElem->staticActParams[i])));
+ CHKiRet(tplToArray(pAction->ppTpl[i], pMsg, (uchar***) &(pElem->staticActParams[i]), ttNow));
break;
case ACT_MSG_PASSING:
pElem->staticActParams[i] = (void*) pMsg;
break;
case ACT_JSON_PASSING:
- CHKiRet(tplToJSON(pAction->ppTpl[i], pMsg, &json));
+ CHKiRet(tplToJSON(pAction->ppTpl[i], pMsg, &json, ttNow));
pElem->staticActParams[i] = (void*) json;
break;
default:dbgprintf("software bug/error: unknown pAction->eParamPassing %d in prepareDoActionParams\n",
@@ -1226,14 +1227,19 @@ prepareBatch(action_t *pAction, batch_t *pBatch, sbool **activeSave, int *bMustR
{
int i;
batch_obj_t *pElem;
+ struct syslogTime ttNow;
DEFiRet;
+ if(pAction->requiresDateCall) {
+ datetime.getCurrTime(&ttNow, NULL);
+ }
+
pBatch->iDoneUpTo = 0;
for(i = 0 ; i < batchNumMsgs(pBatch) && !*(pBatch->pbShutdownImmediate) ; ++i) {
pElem = &(pBatch->pElem[i]);
if(batchIsValidElem(pBatch, i)) {
pElem->state = BATCH_STATE_RDY;
- if(prepareDoActionParams(pAction, pElem) != RS_RET_OK) {
+ if(prepareDoActionParams(pAction, pElem, &ttNow) != RS_RET_OK) {
/* make sure we have our copy of "active" array */
if(!*bMustRestoreActivePtr) {
*activeSave = pBatch->active;
@@ -1875,6 +1881,23 @@ actionApplyCnfParam(action_t *pAction, struct cnfparamvals *pvals)
return RS_RET_OK;
}
+/* check if the templates used in this action require a date call
+ * ($NOW family of properties).
+ */
+static inline int
+actionRequiresDateCall(action_t *pAction)
+{
+ int i;
+ int r = 0;
+
+ for(i = 0 ; i < pAction->iNumTpls ; ++i) {
+ if(tplRequiresDateCall(pAction->ppTpl[i])) {
+ r = 1;
+ break;
+ }
+ }
+ return r;
+}
/* add an Action to the current selector
@@ -1980,6 +2003,7 @@ addAction(action_t **ppAction, modInfo_t *pMod, void *pModData,
pAction->f_ReduceRepeated = 0;
}
pAction->eState = ACT_STATE_RDY; /* action is enabled */
+ pAction->requiresDateCall = actionRequiresDateCall(pAction);
if(bSuspended)
actionSuspend(pAction, datetime.GetTime(NULL)); /* "good" time call, only during init and unavoidable */
diff --git a/action.h b/action.h
index bce36b4c..177fd682 100644
--- a/action.h
+++ b/action.h
@@ -70,6 +70,7 @@ struct action_s {
void *pModData; /* pointer to module data - content is module-specific */
sbool bRepMsgHasMsg; /* "message repeated..." has msg fragment in it (0-no, 1-yes) */
short f_ReduceRepeated;/* reduce repeated lines 0 - no, 1 - yes */
+ sbool requiresDateCall;/* do we need to do a date call before creating templates? */
int f_prevcount; /* repetition cnt of prevline */
int f_repeatcount; /* number of "repeated" msgs */
rsRetVal (*submitToActQ)(action_t *, batch_t *);/* function submit message to action queue */
diff --git a/configure.ac b/configure.ac
index f817ca06..660c7ee9 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],[7.3.0],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[7.3.1],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@@ -35,8 +35,7 @@ PKG_PROG_PKG_CONFIG
PKG_CHECK_MODULES(LIBESTR, libestr >= 0.1.2)
PKG_CHECK_MODULES(LIBEE, libee >= 0.4.0)
PKG_CHECK_MODULES([JSON_C], [json])
-AC_SUBST([JSON_CFLAGS])
-AC_SUBST([JSON_LIBS])
+PKG_CHECK_MODULES([LIBUUID], [uuid])
case "${host}" in
*-*-linux*)
@@ -701,22 +700,6 @@ AM_CONDITIONAL(ENABLE_OMLIBDBI, test x$enable_libdbi = xyes)
AC_SUBST(LIBDBI_CFLAGS)
AC_SUBST(LIBDBI_LIBS)
-# libuuid support
-AC_CHECK_HEADERS(
- [uuid/uuid.h],,
- [AC_MSG_FAILURE([libuuid is missing])]
-)
-AC_CHECK_LIB(
- [uuid],
- [uuid_generate],
- [LIBUUID_CFLAGS=""
- LIBUUID_LIBS="-luuid"
- ],
- [AC_MSG_FAILURE([libuuid library is missing])]
-)
-AC_SUBST(LIBUUID_CFLAGS)
-AC_SUBST(LIBUUID_LIBS)
-
# SNMP support
AC_ARG_ENABLE(snmp,
[AS_HELP_STRING([--enable-snmp],[Enable SNMP support @<:@default=no@:>@])],
@@ -757,27 +740,9 @@ AC_ARG_ENABLE(elasticsearch,
[enable_elasticsearch=no]
)
if test "x$enable_elasticsearch" = "xyes"; then
- AC_CHECK_PROG(
- [HAVE_CURL_CONFIG],
- [curl-config],
- [yes],,,
- )
- if test "x${HAVE_CURL_CONFIG}" != "xyes"; then
- AC_MSG_FAILURE([curl-config not found in PATH])
- fi
- AC_CHECK_LIB(
- [curl],
- [curl_global_init],
- [CURL_CFLAGS="`curl-config --cflags`"
- CURL_LIBS="`curl-config --libs`"
- ],
- [AC_MSG_FAILURE([curl library is missing])],
- [`curl-config --libs --cflags`]
- )
+ PKG_CHECK_MODULES([CURL], [libcurl])
fi
AM_CONDITIONAL(ENABLE_ELASTICSEARCH, test x$enable_elasticsearch = xyes)
-AC_SUBST(CURL_CFLAGS)
-AC_SUBST(CURL_LIBS)
# GnuTLS support
@@ -795,8 +760,6 @@ if test "x$enable_gnutls" = "xyes"; then
AC_DEFINE([ENABLE_GNUTLS], [1], [Indicator that GnuTLS is present])
fi
AM_CONDITIONAL(ENABLE_GNUTLS, test x$enable_gnutls = xyes)
-AC_SUBST(GNUTLS_CFLAGS)
-AC_SUBST(GNUTLS_LIBS)
# support for building the rsyslogd runtime
@@ -812,7 +775,6 @@ AC_ARG_ENABLE(rsyslogrt,
if test "x$enable_rsyslogrt" = "xyes"; then
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) \$(JSON_C_FLAGS)"
@@ -914,8 +876,6 @@ if test "x$enable_mmnormalize" = "xyes"; then
PKG_CHECK_MODULES(LIBLOGNORM, lognorm >= 0.3.1)
fi
AM_CONDITIONAL(ENABLE_MMNORMALIZE, test x$enable_mmnormalize = xyes)
-AC_SUBST(LOGNORM_CFLAGS)
-AC_SUBST(LOGNORM_LIBS)
# mmnjsonparse
@@ -965,8 +925,6 @@ if test "x$enable_relp" = "xyes"; then
PKG_CHECK_MODULES(RELP, relp >= 1.0.1)
fi
AM_CONDITIONAL(ENABLE_RELP, test x$enable_relp = xyes)
-AC_SUBST(RELP_CFLAGS)
-AC_SUBST(RELP_LIBS)
# RFC 3195 support
@@ -983,8 +941,6 @@ if test "x$enable_rfc3195" = "xyes"; then
PKG_CHECK_MODULES(LIBLOGGING, liblogging >= 0.7.1)
fi
AM_CONDITIONAL(ENABLE_RFC3195, test x$enable_rfc3195 = xyes)
-AC_SUBST(LIBLOGGING_CFLAGS)
-AC_SUBST(LIBLOGGING_LIBS)
# enable/disable the testbench (e.g. because some important parts
@@ -1217,9 +1173,6 @@ fi
AM_CONDITIONAL(ENABLE_GUI, test x$enable_gui = xyes)
-AC_SUBST(RELP_CFLAGS)
-AC_SUBST(RELP_LIBS)
-
# settings for omuxsock
AC_ARG_ENABLE(omuxsock,
[AS_HELP_STRING([--enable-omuxsock],[Compiles omuxsock module @<:@default=no@:>@])],
@@ -1290,8 +1243,6 @@ AC_ARG_ENABLE(ommongodb,
)
if test "x$enable_ommongodb" = "xyes"; then
PKG_CHECK_MODULES(LIBMONGO_CLIENT, libmongo-client >= 0.1.4)
- AC_SUBST(LIBMONGO_CLIENT_CFLAGS)
- AC_SUBST(LIBMONGO_CLIENT_LIBS)
fi
AM_CONDITIONAL(ENABLE_OMMONGODB, test x$enable_ommongodb = xyes)
# end of mongodb code
@@ -1308,8 +1259,6 @@ AC_ARG_ENABLE(imzmq3,
)
if test "x$enable_imzmq3" = "xyes"; then
PKG_CHECK_MODULES(CZMQ, libczmq >= 1.1.0)
- AC_SUBST(CZMQ_CFLAGS)
- AC_SUBST(CZMQ_LIBS)
fi
AM_CONDITIONAL(ENABLE_IMZMQ3, test x$enable_imzmq3 = xyes)
@@ -1327,8 +1276,6 @@ AC_ARG_ENABLE(omzmq3,
)
if test "x$enable_omzmq3" = "xyes"; then
PKG_CHECK_MODULES(CZMQ, libczmq >= 1.1.0)
- AC_SUBST(CZMQ_CFLAGS)
- AC_SUBST(CZMQ_LIBS)
fi
AM_CONDITIONAL(ENABLE_OMZMQ3, test x$enable_omzmq3 = xyes)
@@ -1348,8 +1295,6 @@ AC_ARG_ENABLE(omhiredis,
#
if test "x$enable_omhiredis" = "xyes"; then
PKG_CHECK_MODULES(HIREDIS, hiredis >= 0.10.1)
- AC_SUBST(HIREDIS_CFLAGS)
- AC_SUBST(HIREDIS_LIBS)
fi
AM_CONDITIONAL(ENABLE_OMHIREDIS, test x$enable_omhiredis = xyes)
@@ -1407,7 +1352,6 @@ AC_CONFIG_FILES([Makefile \
plugins/mmsnmptrapd/Makefile \
java/Makefile \
tests/Makefile])
-#add on demand: plugins/cust1/Makefile
AC_OUTPUT
echo "****************************************************"
diff --git a/doc/imklog.html b/doc/imklog.html
index 2e3b3bc2..b62f4f92 100644
--- a/doc/imklog.html
+++ b/doc/imklog.html
@@ -15,7 +15,10 @@
syslog engine.</p>
<p><b>Configuration Directives</b>:</p>
<ul>
-<li><strong>$KLogInternalMsgFacility
+<li><strong>LogPath</strong><br>
+The path to the Kernel log. This value should only be changed if you really know what
+you are doing.</li>
+<li><strong>InternalMsgFacility
&lt;facility&gt;</strong><br>
The facility which messages internally generated by imklog will have.
imklog generates some messages of itself (e.g. on problems, startup and
@@ -26,13 +29,47 @@ need to specify this configuratin directive - it is included primarily
for few limited cases where it is needed for good reason. Bottom line:
if you don't have a good idea why you should use this setting, do not
touch it.</li>
-<li><span style="font-weight: bold;">$KLogPermitNonKernelFacility
+<li><span style="font-weight: bold;">PermitNonKernelFacility
[on/<span style="font-style: italic;">off</span>]<br>
</span>At least under BSD the kernel log may contain entries
with non-kernel facilities. This setting controls how those are
handled. The default is "off", in which case these messages are
ignored. Switch it to on to submit non-kernel messages to rsyslog
processing.<span style="font-weight: bold;"></span></li>
+<li><b>KeepKernelTimeStamp</b> [on/<b>off</b>] --
+<br>if the Kernel creates a timestamp for its log messages, this timestamp will be preserved.
+If disabled, the time when the message is received will be used.<br>
+<li><b>ConsoleLogLevel</b> [<i>number</i>]
+(former klogd -c option) -- sets the console log level. If specified, only messages with
+up to the specified level are printed to the console. The default is -1, which means that
+the current settings are not modified. To get this behavior, do not specify
+ConsoleLogLevel in the configuration file. Note that this is a global parameter. Each time
+it is changed, the previous definition is re-set. The one activate will be that one that is
+active when imklog actually starts processing. In short words: do not specify this
+directive more than once!
+</ul>
+<b>Caveats/Known Bugs:</b>
+<p>This is obviously platform specific and requires platform
+drivers.
+Currently, imklog functionality is available on Linux and BSD.</p>
+<p>This module is <b>not supported on Solaris</b> and not needed there.
+For Solaris kernel input, use <a href="imsolaris.html">imsolaris</a>.</p>
+<p><b>Sample:</b></p>
+<p>The following sample pulls messages from the kernel log. All
+parameters are left by default, which is usually a good idea. Please
+note that loading the plugin is sufficient to activate it. No directive
+is needed to start pulling kernel messages.<br>
+</p>
+<textarea rows="15" cols="60">module(load="imklog")
+</textarea>
+<p><b>Legacy Configuration Directives</b>:</p>
+<ul>
+<li><strong>$KLogInternalMsgFacility
+&lt;facility&gt;</strong><br>
+equivalent to: InternalMsgFacility</li>
+<li><span style="font-weight: bold;">$KLogPermitNonKernelFacility
+[on/<span style="font-style: italic;">off</span>]<br>
+equivalent to: PermitNonKernelFacility</li>
<li><span style="font-weight: bold;"></span>$DebugPrintKernelSymbols
[on/<b>off</b>]<br>
Linux only, ignored on other platforms (but may be specified)</li>
@@ -50,14 +87,7 @@ it except if you have a very good reason. If you have one, let us know
because otherwise new versions will no longer support it.<br>
Linux only, ignored on other platforms (but may be specified)</li>
<li><b>$klogConsoleLogLevel</b> [<i>number</i>]
-(former klogd -c option) -- sets the console log level. If specified, only messages with
-up to the specified level are printed to the console. The default is -1, which means that
-the current settings are not modified. To get this behavior, do not specify
-$klogConsoleLogLevel in the configuration file. Note that this is a global parameter. Each time
-it is changed, the previous definition is re-set. The one activate will be that one that is
-active when imklog actually starts processing. In short words: do not specify this
-directive more than once!
-<br><b>Linux only</b>, ignored on other platforms (but may be specified)</li>
+<br>equivalent to: ConsoleLogLevel</li>
<li><b>$klogUseSyscallInterface</b> [on/<b>off</b>]
-- former klogd -s option<br>
Linux only, ignored on other platforms (but may be specified)</li>
@@ -66,26 +96,12 @@ former klogd -2 option<br>
Linux only, ignored on other platforms (but may be specified)<br style="font-weight: bold;">
</li>
</ul>
-<b>Caveats/Known Bugs:</b>
-<p>This is obviously platform specific and requires platform
-drivers.
-Currently, imklog functionality is available on Linux and BSD.</p>
-<p>This module is <b>not supported on Solaris</b> and not needed there.
-For Solaris kernel input, use <a href="imsolaris.html">imsolaris</a>.</p>
-<p><b>Sample:</b></p>
-<p>The following sample pulls messages from the kernel log. All
-parameters are left by default, which is usually a good idea. Please
-note that loading the plugin is sufficient to activate it. No directive
-is needed to start pulling kernel messages.<br>
-</p>
-<textarea rows="15" cols="60">$ModLoad imklog
-</textarea>
<p>[<a href="rsyslog_conf.html">rsyslog.conf overview</a>]
[<a href="manual.html">manual index</a>] [<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
<p><font size="2">This documentation is part of the
<a href="http://www.rsyslog.com/">rsyslog</a>
project.<br>
-Copyright &copy; 2008-2009 by <a href="http://www.gerhards.net/rainer">Rainer
+Copyright &copy; 2008-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>
diff --git a/doc/manual.html b/doc/manual.html
index ea456c44..e3a5e62b 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 7.3.0 (devel branch) of rsyslog.</b>
+<p><b>This documentation is for version 7.3.1 (devel 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/plugins/imklog/bsd.c b/plugins/imklog/bsd.c
index 80ff9494..ad194b58 100644
--- a/plugins/imklog/bsd.c
+++ b/plugins/imklog/bsd.c
@@ -58,9 +58,6 @@ static int fklog = -1; /* kernel log fd */
#ifdef OS_LINUX
/* submit a message to imklog Syslog() API. In this function, we check if
* a kernel timestamp is present and, if so, extract and strip it.
- * Note: this is an extra processing step. We should revisit the whole
- * idea in v6 and remove all that old stuff that we do not longer need
- * (like symbol resolution). <-- TODO
* Note that this is heavily Linux specific and thus is not compiled or
* used for BSD.
* Special thanks to Lennart Poettering for suggesting on how to convert
@@ -73,7 +70,7 @@ static int fklog = -1; /* kernel log fd */
* rgerhards, 2011-06-24
*/
static void
-submitSyslog(int pri, uchar *buf)
+submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
{
long secs;
long nsecs;
@@ -92,7 +89,9 @@ submitSyslog(int pri, uchar *buf)
/* we now try to parse the timestamp. iff it parses, we assume
* it is a timestamp. Otherwise we know for sure it is no ts ;)
*/
- i = 4; /* first digit after '[' */
+ i = 4; /* space or first digit after '[' */
+ while(buf[i] && isspace(buf[i]))
+ ++i; /* skip space */
secs = 0;
while(buf[i] && isdigit(buf[i])) {
secs = secs * 10 + buf[i] - '0';
@@ -117,8 +116,10 @@ submitSyslog(int pri, uchar *buf)
/* we have a timestamp */
DBGPRINTF("kernel timestamp is %ld %ld\n", secs, nsecs);
- bufsize= strlen((char*)buf);
- memcpy(buf+3, buf+i, bufsize - i + 1);
+ if(!pModConf->bKeepKernelStamp) {
+ bufsize= strlen((char*)buf);
+ memmove(buf+3, buf+i, bufsize - i + 1);
+ }
clock_gettime(CLOCK_MONOTONIC, &monotonic);
clock_gettime(CLOCK_REALTIME, &realtime);
@@ -144,7 +145,7 @@ done:
}
#else /* now comes the BSD "code" (just a shim) */
static void
-submitSyslog(int pri, uchar *buf)
+submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
{
Syslog(pri, buf, NULL);
}
@@ -194,7 +195,7 @@ finalize_it:
/* Read kernel log while data are available, split into lines.
*/
static void
-readklog(void)
+readklog(modConfData_t *pModConf)
{
char *p, *q;
int len, i;
@@ -236,18 +237,18 @@ readklog(void)
for (p = (char*)pRcv; (q = strchr(p, '\n')) != NULL; p = q + 1) {
*q = '\0';
- submitSyslog(LOG_INFO, (uchar*) p);
+ submitSyslog(pModConf, LOG_INFO, (uchar*) p);
}
len = strlen(p);
if (len >= iMaxLine - 1) {
- submitSyslog(LOG_INFO, (uchar*)p);
+ submitSyslog(pModConf, LOG_INFO, (uchar*)p);
len = 0;
}
if(len > 0)
memmove(pRcv, p, len + 1);
}
if (len > 0)
- submitSyslog(LOG_INFO, pRcv);
+ submitSyslog(pModConf, LOG_INFO, pRcv);
if(pRcv != NULL && (size_t) iMaxLine >= sizeof(bufRcv) - 1)
free(pRcv);
@@ -276,10 +277,10 @@ rsRetVal klogAfterRun(modConfData_t *pModConf)
* "message pull" mechanism.
* rgerhards, 2008-04-09
*/
-rsRetVal klogLogKMsg(modConfData_t __attribute__((unused)) *pModConf)
+rsRetVal klogLogKMsg(modConfData_t *pModConf)
{
DEFiRet;
- readklog();
+ readklog(pModConf);
RETiRet;
}
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 93323707..2897d76d 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -91,6 +91,7 @@ static int bLegacyCnfModGlobalsPermitted;/* are legacy module-global config para
static struct cnfparamdescr modpdescr[] = {
{ "logpath", eCmdHdlrGetWord, 0 },
{ "permitnonkernelfacility", eCmdHdlrBinary, 0 },
+ { "keepkerneltimestamp", eCmdHdlrBinary, 0 },
{ "consoleloglevel", eCmdHdlrInt, 0 },
{ "internalmsgfacility", eCmdHdlrFacility, 0 }
};
@@ -289,6 +290,7 @@ CODESTARTbeginCnfLoad
pModConf->pszPath = NULL;
pModConf->bPermitNonKernel = 0;
pModConf->console_log_level = -1;
+ pModConf->bKeepKernelStamp = 0;
pModConf->iFacilIntMsg = klogFacilIntMsg();
loadModConf->configSetViaV2Method = 0;
bLegacyCnfModGlobalsPermitted = 1;
@@ -322,6 +324,8 @@ CODESTARTsetModCnf
loadModConf->bPermitNonKernel = (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "consoleloglevel")) {
loadModConf->console_log_level= (int) pvals[i].val.d.n;
+ } else if(!strcmp(modpblk.descr[i].name, "keepkerneltimestamp")) {
+ loadModConf->bKeepKernelStamp = (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "internalmsgfacility")) {
loadModConf->iFacilIntMsg = (int) pvals[i].val.d.n;
} else {
@@ -347,6 +351,7 @@ CODESTARTendCnfLoad
loadModConf->bPermitNonKernel = cs.bPermitNonKernel;
loadModConf->iFacilIntMsg = cs.iFacilIntMsg;
loadModConf->console_log_level = cs.console_log_level;
+ loadModConf->bKeepKernelStamp = 0;
if((cs.pszPath == NULL) || (cs.pszPath[0] == '\0')) {
loadModConf->pszPath = NULL;
if(cs.pszPath != NULL)
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index acfb50ab..6cd97c37 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -36,6 +36,7 @@ struct modConfData_s {
uchar *pszPath;
int console_log_level;
sbool bPermitNonKernel;
+ sbool bKeepKernelStamp; /* keep kernel timestamp instead of interpreting it */
sbool configSetViaV2Method;
};
diff --git a/plugins/imklog/solaris_cddl.c b/plugins/imklog/solaris_cddl.c
index 7e86c68c..cf5467fc 100644
--- a/plugins/imklog/solaris_cddl.c
+++ b/plugins/imklog/solaris_cddl.c
@@ -216,7 +216,7 @@ sun_getkmsg()
*/
remlen = buflen - len;
- (void) memcpy(buf, &buf[len], remlen);
+ (void) memmove(buf, &buf[len], remlen);
dat.maxlen = MAXLINE - remlen;
dat.buf = &buf[remlen];
} else {
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 3b140847..9b6409c1 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -591,7 +591,7 @@ rsRetVal rcvMainLoop(thrdInfo_t *pThrd)
for(lstn = lcnfRoot ; lstn != NULL ; lstn = lstn->next) {
if(lstn->sock != -1) {
udpEPollEvt[i].events = EPOLLIN | EPOLLET;
- udpEPollEvt[i].data.u64 = (long long unsigned) lstn;
+ udpEPollEvt[i].data.ptr = lstn;
if(epoll_ctl(efd, EPOLL_CTL_ADD, lstn->sock, &(udpEPollEvt[i])) < 0) {
rs_strerror_r(errno, errStr, sizeof(errStr));
errmsg.LogError(errno, NO_ERRCODE, "epoll_ctrl failed on fd %d with %s\n",
@@ -610,7 +610,7 @@ rsRetVal rcvMainLoop(thrdInfo_t *pThrd)
break; /* terminate input! */
for(i = 0 ; i < nfds ; ++i) {
- processSocket(pThrd, (struct lstn_s*)currEvt[i].data.u64, &frominetPrev, &bIsPermitted);
+ processSocket(pThrd, currEvt[i].data.ptr, &frominetPrev, &bIsPermitted);
}
}
diff --git a/plugins/imuxsock/Makefile.am b/plugins/imuxsock/Makefile.am
index 34a0ad9a..28f9f9e3 100644
--- a/plugins/imuxsock/Makefile.am
+++ b/plugins/imuxsock/Makefile.am
@@ -1,6 +1,6 @@
pkglib_LTLIBRARIES = imuxsock.la
imuxsock_la_SOURCES = imuxsock.c
-imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I../../runtime/hashtable -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
+imuxsock_la_CPPFLAGS = -DSD_EXPORT_SYMBOLS -I$(top_srcdir) $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
imuxsock_la_LDFLAGS = -module -avoid-version
imuxsock_la_LIBADD = $(RSRT_LIBS)
diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c
index f1bdc835..1409c24a 100644
--- a/plugins/imuxsock/imuxsock.c
+++ b/plugins/imuxsock/imuxsock.c
@@ -1465,11 +1465,6 @@ CODEmodInit_QueryRegCFSLineHdlr
listeners[i].fd = -1;
}
- /* now init listen socket zero, the local log socket */
- CHKiRet(prop.Construct(&pLocalHostIP));
- CHKiRet(prop.SetString(pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
- CHKiRet(prop.ConstructFinalize(pLocalHostIP));
-
/* register config file handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputunixlistensocketignoremsgtimestamp", 0, eCmdHdlrBinary,
NULL, &cs.bIgnoreTimestamp, STD_LOADABLE_MODULE_ID));
diff --git a/plugins/ommongodb/ommongodb.c b/plugins/ommongodb/ommongodb.c
index 2c65f275..57ef20b2 100644
--- a/plugins/ommongodb/ommongodb.c
+++ b/plugins/ommongodb/ommongodb.c
@@ -233,11 +233,11 @@ getDefaultBSON(msg_t *pMsg)
gint64 ts_gen, ts_rcv; /* timestamps: generated, received */
int secfrac;
- procid = MsgGetProp(pMsg, NULL, PROP_PROGRAMNAME, NULL, &procid_len, &procid_free);
- tag = MsgGetProp(pMsg, NULL, PROP_SYSLOGTAG, NULL, &tag_len, &tag_free);
- pid = MsgGetProp(pMsg, NULL, PROP_PROCID, NULL, &pid_len, &pid_free);
- sys = MsgGetProp(pMsg, NULL, PROP_HOSTNAME, NULL, &sys_len, &sys_free);
- msg = MsgGetProp(pMsg, NULL, PROP_MSG, NULL, &msg_len, &msg_free);
+ procid = MsgGetProp(pMsg, NULL, PROP_PROGRAMNAME, NULL, &procid_len, &procid_free, NULL);
+ tag = MsgGetProp(pMsg, NULL, PROP_SYSLOGTAG, NULL, &tag_len, &tag_free, NULL);
+ pid = MsgGetProp(pMsg, NULL, PROP_PROCID, NULL, &pid_len, &pid_free, NULL);
+ sys = MsgGetProp(pMsg, NULL, PROP_HOSTNAME, NULL, &sys_len, &sys_free, NULL);
+ msg = MsgGetProp(pMsg, NULL, PROP_MSG, NULL, &msg_len, &msg_free, NULL);
// TODO: move to datetime? Refactor in any case! rgerhards, 2012-03-30
ts_gen = (gint64) datetime.syslogTime2time_t(&pMsg->tTIMESTAMP) * 1000; /* ms! */
diff --git a/rsyslog.service.in b/rsyslog.service.in
index a5d53ad2..08a4870f 100644
--- a/rsyslog.service.in
+++ b/rsyslog.service.in
@@ -2,8 +2,7 @@
Description=System Logging Service
[Service]
-ExecStartPre=/bin/systemctl stop systemd-kmsg-syslogd.service
-ExecStart=@sbindir@/rsyslogd -n -c6
+ExecStart=@sbindir@/rsyslogd -n
Sockets=syslog.socket
StandardOutput=null
diff --git a/runtime/msg.c b/runtime/msg.c
index d874178b..b0b93f98 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -2373,40 +2373,38 @@ char *textpri(char *pRes, size_t pResLen, int pri)
*/
typedef enum ENOWType { NOW_NOW, NOW_YEAR, NOW_MONTH, NOW_DAY, NOW_HOUR, NOW_HHOUR, NOW_QHOUR, NOW_MINUTE } eNOWType;
#define tmpBUFSIZE 16 /* size of formatting buffer */
-static uchar *getNOW(eNOWType eNow)
+static uchar *getNOW(eNOWType eNow, struct syslogTime *t)
{
uchar *pBuf;
- struct syslogTime t;
if((pBuf = (uchar*) MALLOC(sizeof(uchar) * tmpBUFSIZE)) == NULL) {
return NULL;
}
- datetime.getCurrTime(&t, NULL);
switch(eNow) {
case NOW_NOW:
- snprintf((char*) pBuf, tmpBUFSIZE, "%4.4d-%2.2d-%2.2d", t.year, t.month, t.day);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%4.4d-%2.2d-%2.2d", t->year, t->month, t->day);
break;
case NOW_YEAR:
- snprintf((char*) pBuf, tmpBUFSIZE, "%4.4d", t.year);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%4.4d", t->year);
break;
case NOW_MONTH:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.month);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->month);
break;
case NOW_DAY:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.day);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->day);
break;
case NOW_HOUR:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->hour);
break;
case NOW_HHOUR:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute / 30);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->minute / 30);
break;
case NOW_QHOUR:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute / 15);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->minute / 15);
break;
case NOW_MINUTE:
- snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute);
+ snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t->minute);
break;
}
@@ -2673,7 +2671,7 @@ finalize_it:
* Parameter "bMustBeFreed" is set by this function. It tells the
* caller whether or not the string returned must be freed by the
* caller itself. It is is 0, the caller MUST NOT free it. If it is
- * 1, the caller MUST free 1. Handling this wrongly leads to either
+ * 1, the caller MUST free it. Handling this wrongly leads to either
* a memory leak of a program abort (do to double-frees or frees on
* the constant memory pool). So be careful to do it right.
* rgerhards 2004-11-23
@@ -2690,7 +2688,7 @@ finalize_it:
return(UCHAR_CONSTANT("**OUT OF MEMORY**"));}
uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
propid_t propid, es_str_t *propName, rs_size_t *pPropLen,
- unsigned short *pbMustBeFreed)
+ unsigned short *pbMustBeFreed, struct syslogTime *ttNow)
{
uchar *pRes; /* result pointer */
rs_size_t bufLen = -1; /* length of string or -1, if not known */
@@ -2803,52 +2801,68 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
pRes = (uchar*)getParseSuccess(pMsg);
break;
case PROP_SYS_NOW:
- if((pRes = getNOW(NOW_NOW)) == NULL) {
+ if((pRes = getNOW(NOW_NOW, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 10;
+ }
break;
case PROP_SYS_YEAR:
- if((pRes = getNOW(NOW_YEAR)) == NULL) {
+ if((pRes = getNOW(NOW_YEAR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 4;
+ }
break;
case PROP_SYS_MONTH:
- if((pRes = getNOW(NOW_MONTH)) == NULL) {
+ if((pRes = getNOW(NOW_MONTH, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_DAY:
- if((pRes = getNOW(NOW_DAY)) == NULL) {
+ if((pRes = getNOW(NOW_DAY, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_HOUR:
- if((pRes = getNOW(NOW_HOUR)) == NULL) {
+ if((pRes = getNOW(NOW_HOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_HHOUR:
- if((pRes = getNOW(NOW_HHOUR)) == NULL) {
+ if((pRes = getNOW(NOW_HHOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_QHOUR:
- if((pRes = getNOW(NOW_QHOUR)) == NULL) {
+ if((pRes = getNOW(NOW_QHOUR, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_MINUTE:
- if((pRes = getNOW(NOW_MINUTE)) == NULL) {
+ if((pRes = getNOW(NOW_MINUTE, ttNow)) == NULL) {
RET_OUT_OF_MEMORY;
- } else
- *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */
+ } else {
+ *pbMustBeFreed = 1;
+ bufLen = 2;
+ }
break;
case PROP_SYS_MYHOSTNAME:
pRes = glbl.GetLocalHostName();
@@ -2907,7 +2921,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
}
/* If we did not receive a template pointer, we are already done... */
- if(pTpe == NULL) {
+ if(pTpe == NULL || !pTpe->bComplexProcessing) {
*pPropLen = (bufLen == -1) ? ustrlen(pRes) : bufLen;
return pRes;
}
@@ -3494,9 +3508,7 @@ uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
jsonField(pTpe, &pRes, pbMustBeFreed, &bufLen);
}
- if(bufLen == -1)
- bufLen = ustrlen(pRes);
- *pPropLen = bufLen;
+ *pPropLen = (bufLen == -1) ? ustrlen(pRes) : bufLen;
ENDfunc
return(pRes);
@@ -3553,7 +3565,7 @@ msgGetMsgVarNew(msg_t *pThis, uchar *name)
/* always call MsgGetProp() without a template specifier */
/* TODO: optimize propNameToID() call -- rgerhards, 2009-06-26 */
propNameStrToID(name, &propid);
- pszProp = (uchar*) MsgGetProp(pThis, NULL, propid, NULL, &propLen, &bMustBeFreed);
+ pszProp = (uchar*) MsgGetProp(pThis, NULL, propid, NULL, &propLen, &bMustBeFreed, NULL);
estr = es_newStrFromCStr((char*)pszProp, propLen);
if(bMustBeFreed)
diff --git a/runtime/msg.h b/runtime/msg.h
index 396e861f..172ae0da 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -173,7 +173,7 @@ void MsgSetRawMsg(msg_t *pMsg, char* pszRawMsg, size_t lenMsg);
rsRetVal MsgReplaceMSG(msg_t *pThis, uchar* pszMSG, int lenMSG);
uchar *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe,
propid_t propid, es_str_t *propName,
- rs_size_t *pPropLen, unsigned short *pbMustBeFreed);
+ rs_size_t *pPropLen, unsigned short *pbMustBeFreed, struct syslogTime *ttNow);
char *textpri(char *pRes, size_t pResLen, int pri);
rsRetVal msgGetMsgVar(msg_t *pThis, cstr_t *pstrPropName, var_t **ppVar);
es_str_t* msgGetMsgVarNew(msg_t *pThis, uchar *name);
diff --git a/runtime/nsdpoll_ptcp.c b/runtime/nsdpoll_ptcp.c
index 8c90d7fd..e69c0fbb 100644
--- a/runtime/nsdpoll_ptcp.c
+++ b/runtime/nsdpoll_ptcp.c
@@ -76,7 +76,7 @@ addEvent(nsdpoll_ptcp_t *pThis, int id, void *pUsr, int mode, nsd_ptcp_t *pSock,
pNew->event.events |= EPOLLIN;
if(mode & NSDPOLL_OUT)
pNew->event.events |= EPOLLOUT;
- pNew->event.data.u64 = (uint64) pNew;
+ pNew->event.data.ptr = pNew;
pthread_mutex_lock(&pThis->mutEvtLst);
pNew->pNext = pThis->pRoot;
pThis->pRoot = pNew;
@@ -254,7 +254,7 @@ Wait(nsdpoll_t *pNsdpoll, int timeout, int *numEntries, nsd_epworkset_t workset[
/* we got valid events, so tell the caller... */
dbgprintf("epoll returned %d entries\n", nfds);
for(i = 0 ; i < nfds ; ++i) {
- pOurEvt = (nsdpoll_epollevt_lst_t*) event[i].data.u64;
+ pOurEvt = (nsdpoll_epollevt_lst_t*) event[i].data.ptr;
workset[i].id = pOurEvt->id;
workset[i].pUsr = pOurEvt->pUsr;
dbgprintf("epoll push ppusr[%d]: %p\n", i, pOurEvt->pUsr);
diff --git a/runtime/ruleset.c b/runtime/ruleset.c
index bdeb61b7..d2c21424 100644
--- a/runtime/ruleset.c
+++ b/runtime/ruleset.c
@@ -378,7 +378,8 @@ evalPROPFILT(struct cnfstmt *stmt, msg_t *pMsg)
goto done;
pszPropVal = MsgGetProp(pMsg, NULL, stmt->d.s_propfilt.propID,
- stmt->d.s_propfilt.propName, &propLen, &pbMustBeFreed);
+ stmt->d.s_propfilt.propName, &propLen,
+ &pbMustBeFreed, NULL);
/* Now do the compares (short list currently ;)) */
switch(stmt->d.s_propfilt.operation ) {
diff --git a/template.c b/template.c
index 2fc85e55..986dbfd6 100644
--- a/template.c
+++ b/template.c
@@ -141,7 +141,9 @@ finalize_it:
* offers big performance improvements.
* rewritten 2009-06-19 rgerhards
*/
-rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *pLenBuf)
+rsRetVal
+tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *pLenBuf,
+ struct syslogTime *ttNow)
{
DEFiRet;
struct templateEntry *pTpe;
@@ -191,7 +193,8 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
bMustBeFreed = 0;
} else if(pTpe->eEntryType == FIELD) {
pVal = (uchar*) MsgGetProp(pMsg, pTpe, pTpe->data.field.propid,
- pTpe->data.field.propName, &iLenVal, &bMustBeFreed);
+ pTpe->data.field.propName, &iLenVal,
+ &bMustBeFreed, ttNow);
/* we now need to check if we should use SQL option. In this case,
* we must go over the generated string and escape '\'' characters.
* rgerhards, 2005-09-22: the option values below look somewhat misplaced,
@@ -245,7 +248,8 @@ finalize_it:
* is indicated by a NULL pointer.
* rgerhards, 2009-04-03
*/
-rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr)
+rsRetVal
+tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr, struct syslogTime *ttNow)
{
DEFiRet;
struct templateEntry *pTpe;
@@ -286,7 +290,8 @@ rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr)
CHKmalloc(pArr[iArr] = (uchar*)strdup((char*) pTpe->data.constant.pConstant));
} else if(pTpe->eEntryType == FIELD) {
pVal = (uchar*) MsgGetProp(pMsg, pTpe, pTpe->data.field.propid,
- pTpe->data.field.propName, &propLen, &bMustBeFreed);
+ pTpe->data.field.propName, &propLen,
+ &bMustBeFreed, ttNow);
if(bMustBeFreed) { /* if it must be freed, it is our own private copy... */
pArr[iArr] = pVal; /* ... so we can use it! */
} else {
@@ -310,7 +315,7 @@ finalize_it:
* rgerhards, 2012-08-29
*/
rsRetVal
-tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **pjson)
+tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **pjson, struct syslogTime *ttNow)
{
struct templateEntry *pTpe;
rs_size_t propLen;
@@ -353,7 +358,7 @@ tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **pjson)
} else {
pVal = (uchar*) MsgGetProp(pMsg, pTpe, pTpe->data.field.propid,
pTpe->data.field.propName, &propLen,
- &bMustBeFreed);
+ &bMustBeFreed, ttNow);
if(pTpe->data.field.options.bMandatory || propLen > 0) {
jsonf = json_object_new_string_len((char*)pVal, propLen);
json_object_object_add(json, (char*)pTpe->fieldName, jsonf);
@@ -371,6 +376,38 @@ finalize_it:
}
+/* Check if the template requires a date call (actually a cached
+ * date structure). This currently is the case for the $NOW family
+ * of properties.
+ */
+int
+tplRequiresDateCall(struct template *pTpl)
+{
+ struct templateEntry *pTpe;
+ int r = 0;
+
+ if(pTpl->subtree != NULL)
+ goto done;
+
+ for(pTpe = pTpl->pEntryRoot ; pTpe != NULL ; pTpe = pTpe->pNext) {
+ switch(pTpe->data.field.propid) {
+ case PROP_SYS_NOW:
+ case PROP_SYS_YEAR:
+ case PROP_SYS_MONTH:
+ case PROP_SYS_DAY:
+ case PROP_SYS_HOUR:
+ case PROP_SYS_HHOUR:
+ case PROP_SYS_QHOUR:
+ case PROP_SYS_MINUTE:
+ r = 1;
+ goto done;
+ default:break;
+ }
+ }
+done: return r;
+}
+
+
/* Helper to doEscape. This is called if doEscape
* runs out of memory allocating the escaped string.
* Then we are in trouble. We can
@@ -791,6 +828,7 @@ static int do_Parameter(unsigned char **pp, struct template *pTpl)
/* Check frompos, if it has an R, then topos should be a regex */
if(*p == ':') {
+ pTpe->bComplexProcessing = 1;
++p; /* eat ':' */
#ifdef FEATURE_REGEXP
if(*p == 'R') {
@@ -1351,6 +1389,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
int fielddelim = 9; /* default is HT (USACSII 9) */
int re_matchToUse = 0;
int re_submatchToUse = 0;
+ int bComplexProcessing = 0;
char *re_expr = NULL;
struct cnfparamvals *pvals = NULL;
enum {F_NONE, F_CSV, F_JSON, F_JSONF} formatType = F_NONE;
@@ -1376,23 +1415,31 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
free(tmpstr);
} else if(!strcmp(pblkProperty.descr[i].name, "droplastlf")) {
droplastlf = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "mandatory")) {
mandatory = pvals[i].val.d.n;
} else if(!strcmp(pblkProperty.descr[i].name, "spifno1stsp")) {
spifno1stsp = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "outname")) {
outname = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(pblkProperty.descr[i].name, "position.from")) {
frompos = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "position.to")) {
topos = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "field.number")) {
fieldnum = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "field.delimiter")) {
fielddelim = pvals[i].val.d.n;
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "regex.expression")) {
re_expr = es_str2cstr(pvals[i].val.d.estr, NULL);
+ bComplexProcessing = 1;
} else if(!strcmp(pblkProperty.descr[i].name, "regex.type")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"BRE", sizeof("BRE")-1)) {
re_type = TPL_REGEX_BRE;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"ERE", sizeof("ERE")-1)) {
@@ -1405,6 +1452,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
ABORT_FINALIZE(RS_RET_ERR);
}
} else if(!strcmp(pblkProperty.descr[i].name, "regex.nomatchmode")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"DFLT", sizeof("DFLT")-1)) {
re_nomatchType = TPL_REGEX_NOMATCH_USE_DFLTSTR;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"BLANK", sizeof("BLANK")-1)) {
@@ -1421,10 +1469,13 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
ABORT_FINALIZE(RS_RET_ERR);
}
} else if(!strcmp(pblkProperty.descr[i].name, "regex.match")) {
+ bComplexProcessing = 1;
re_matchToUse = pvals[i].val.d.n;
} else if(!strcmp(pblkProperty.descr[i].name, "regex.submatch")) {
+ bComplexProcessing = 1;
re_submatchToUse = pvals[i].val.d.n;
} else if(!strcmp(pblkProperty.descr[i].name, "format")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"csv", sizeof("csv")-1)) {
formatType = F_CSV;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"json", sizeof("json")-1)) {
@@ -1439,6 +1490,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
ABORT_FINALIZE(RS_RET_ERR);
}
} else if(!strcmp(pblkProperty.descr[i].name, "controlcharacters")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"escape", sizeof("escape")-1)) {
controlchr = CC_ESCAPE;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"space", sizeof("space")-1)) {
@@ -1453,6 +1505,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
ABORT_FINALIZE(RS_RET_ERR);
}
} else if(!strcmp(pblkProperty.descr[i].name, "securepath")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"drop", sizeof("drop")-1)) {
secpath = SP_DROP;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"replace", sizeof("replace")-1)) {
@@ -1465,6 +1518,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
ABORT_FINALIZE(RS_RET_ERR);
}
} else if(!strcmp(pblkProperty.descr[i].name, "caseconversion")) {
+ bComplexProcessing = 1;
if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"lower", sizeof("lower")-1)) {
caseconv = tplCaseConvLower;
} else if(!es_strbufcmp(pvals[i].val.d.estr, (uchar*)"upper", sizeof("upper")-1)) {
@@ -1583,6 +1637,7 @@ createPropertyTpe(struct template *pTpl, struct cnfobj *o)
pTpe->fieldName = outname;
if(outname != NULL)
pTpe->lenFieldName = ustrlen(outname);
+ pTpe->bComplexProcessing = bComplexProcessing;
pTpe->data.field.eDateFormat = datefmt;
if(fieldnum != -1) {
pTpe->data.field.has_fields = 1;
@@ -2117,6 +2172,8 @@ void tplPrintList(rsconf_t *conf)
}
break;
}
+ if(pTpe->bComplexProcessing)
+ dbgprintf("[COMPLEX]");
dbgprintf("\n");
pTpe = pTpe->pNext;
}
@@ -2130,8 +2187,6 @@ int tplGetEntryCount(struct template *pTpl)
return(pTpl->tpenElements);
}
-/* our init function. TODO: remove once converted to a class
- */
rsRetVal templateInit()
{
DEFiRet;
diff --git a/template.h b/template.h
index 5a35d274..018e2f52 100644
--- a/template.h
+++ b/template.h
@@ -72,6 +72,7 @@ struct templateEntry {
enum EntryTypes eEntryType;
uchar *fieldName; /**< field name to be used for structured output */
int lenFieldName;
+ sbool bComplexProcessing; /**< set if complex processing (options, etc) is required */
union {
struct {
uchar *pConstant; /* pointer to constant value */
@@ -142,14 +143,15 @@ void tplDeleteNew(rsconf_t *conf);
void tplPrintList(rsconf_t *conf);
void tplLastStaticInit(rsconf_t *conf, struct template *tpl);
rsRetVal ExtendBuf(uchar **pBuf, size_t *pLenBuf, size_t iMinSize);
+int tplRequiresDateCall(struct template *pTpl);
/* note: if a compiler warning for undefined type tells you to look at this
* code line below, the actual cause is that you currently MUST include template.h
* BEFORE msg.h, even if your code file does not actually need it.
* rgerhards, 2007-08-06
*/
-rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr);
-rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz, size_t *);
-rsRetVal tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **);
+rsRetVal tplToArray(struct template *pTpl, msg_t *pMsg, uchar*** ppArr, struct syslogTime *ttNow);
+rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar** ppSz, size_t *, struct syslogTime *ttNow);
+rsRetVal tplToJSON(struct template *pTpl, msg_t *pMsg, struct json_object **, struct syslogTime *ttNow);
rsRetVal doEscape(uchar **pp, rs_size_t *pLen, unsigned short *pbMustBeFreed, int escapeMode);
rsRetVal templateInit();
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 25761708..9d9bd352 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -36,11 +36,11 @@ rsyslogd_SOURCES = \
pidfile.h \
\
../dirty.h
-rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS) $(CNF_LIBS)
+rsyslogd_CPPFLAGS = $(PTHREADS_CFLAGS) $(RSRT_CFLAGS)
# note: it looks like librsyslog.la must be explicitely given on LDDADD,
# otherwise dependencies are not properly calculated (resulting in a
# potentially incomplete build, a problem we had several times...)
-rsyslogd_LDADD = ../grammar/libgrammar.la ../runtime/librsyslog.la $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS) $(SOL_LIBS) $(LIBEE_LIBS) $(LIBLOGNORM_LIBS) $(CNF_LIBS) $(LIBUUID_LIBS)
+rsyslogd_LDADD = ../grammar/libgrammar.la ../runtime/librsyslog.la $(ZLIB_LIBS) $(PTHREADS_LIBS) $(RSRT_LIBS) $(SOL_LIBS) $(LIBEE_LIBS) $(LIBLOGNORM_LIBS) $(LIBUUID_LIBS)
rsyslogd_LDFLAGS = -export-dynamic
if ENABLE_DIAGTOOLS
diff --git a/tools/rsyslogd.8 b/tools/rsyslogd.8
index 6ac30e46..86db690e 100644
--- a/tools/rsyslogd.8
+++ b/tools/rsyslogd.8
@@ -1,7 +1,7 @@
.\" Copyright 2004-2008 Rainer Gerhards and Adiscon for the rsyslog modifications
.\" May be distributed under the GNU General Public License
.\"
-.TH RSYSLOGD 8 "29 July 2008" "Version 3.21.1" "Linux System Administration"
+.TH RSYSLOGD 8 "16 October 2012" "Version 6.4.3" "Linux System Administration"
.SH NAME
rsyslogd \- reliable and extended syslogd
.SH SYNOPSIS
@@ -93,9 +93,6 @@ the error element is ignored. It is tried to parse the rest of the line.
.LP
.SH OPTIONS
-.B Note that in version 3 of rsyslog a number of command line options
-.B have been deprecated and replaced with config file directives. The
-.B -c option controls the backward compatibility mode in use.
.TP
.BI "\-A"
When sending UDP messages, there are potentially multiple paths to
@@ -123,26 +120,9 @@ If neither -4 nor -6 is given,
listens to all configured addresses of the system.
.TP
.BI "\-c " "version"
-Selects the desired backward compatibility mode. It must always be the
-first option on the command line, as it influences processing of the
-other options. To use the rsyslog v3 native interface, specify -c3. To
-use compatibility mode , either do not use -c at all or use
--c<version> where
-.IR version
-is the rsyslog version that it shall be
-compatible with. Using -c0 tells rsyslog to be command-line compatible
-to sysklogd, which is the default if -c is not given.
-.B Please note that rsyslogd issues warning messages if the -c3
-.B command line option is not given.
-This is to alert you that your are running in compatibility
-mode. Compatibility mode interferes with your rsyslog.conf commands and
-may cause some undesired side-effects. It is meant to be used with a
-plain old rsyslog.conf - if you use new features, things become
-messy. So the best advice is to work through this document, convert
-your options and config file and then use rsyslog in native mode. In
-order to aid you in this process, rsyslog logs every
-compatibility-mode config file directive it has generated. So you can
-simply copy them from your logfile and paste them to the config.
+This option has been obsoleted and has no function any longer. It is still
+accepted in order not to break existing scripts. However, future versions
+may not support it.
.TP
.B "\-d"
Turns on debug mode. Using this the daemon will not proceed a
diff --git a/tools/syslogd.c b/tools/syslogd.c
index f76fe8cb..2e5d08cd 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -220,11 +220,6 @@ struct queuefilenames_s {
uchar *name;
} *queuefilenames = NULL;
-/* global variables for config file state */
-int iCompatibilityMode = 0; /* version we should be compatible with; 0 means sysklogd. It is
- the default, so if no -c<n> option is given, we make ourselvs
- as compatible to sysklogd as possible. */
-/* end global config file state variables */
int MarkInterval = 20 * 60; /* interval between marks in seconds - read-only after startup */
int send_to_all = 0; /* send message to all IPv4/IPv6 addresses */
@@ -250,10 +245,9 @@ static void sighup_handler();
static int usage(void)
{
- fprintf(stderr, "usage: rsyslogd [-c<version>] [-46AdnqQvwx] [-l<hostlist>] [-s<domainlist>]\n"
+ fprintf(stderr, "usage: rsyslogd [-46AdnqQvwx] [-l<hostlist>] [-s<domainlist>]\n"
" [-f<conffile>] [-i<pidfile>] [-N<level>] [-M<module load path>]\n"
" [-u<number>]\n"
- "To run rsyslogd in native mode, use \"rsyslogd -c5 <other options>\"\n\n"
"For further information see http://www.rsyslog.com/doc\n");
exit(1); /* "good" exit - done to terminate usage() */
}
@@ -1857,10 +1851,7 @@ int realMain(int argc, char **argv)
* split of functionality, this is no longer a problem. Thanks to varmofekoj for
* suggesting this algo.
* Note: where we just need to set some flags and can do so without knowledge
- * of other options, we do this during the inital option processing. With later
- * versions (if a dependency on -c option is introduced), we must move that code
- * to other places, but I think it is quite appropriate and saves code to do this
- * only when actually neeeded.
+ * of other options, we do this during the inital option processing.
* rgerhards, 2008-04-04
*/
while((ch = getopt(argc, argv, "46a:Ac:def:g:hi:l:m:M:nN:op:qQr::s:t:T:u:vwx")) != EOF) {
@@ -1891,7 +1882,7 @@ int realMain(int argc, char **argv)
CHKiRet(bufOptAdd(ch, optarg));
break;
case 'c': /* compatibility mode */
- iCompatibilityMode = atoi(optarg);
+ fprintf(stderr, "rsyslogd: error: option -c is no longer supported - ignored");
break;
case 'd': /* debug - must be handled now, so that debug is active during init! */
debugging_on = 1;
@@ -1915,8 +1906,8 @@ int realMain(int argc, char **argv)
if(argc - optind)
usage();
- DBGPRINTF("rsyslogd %s startup, compatibility mode %d, module path '%s', cwd:%s\n",
- VERSION, iCompatibilityMode, glblModPath == NULL ? "" : (char*)glblModPath,
+ DBGPRINTF("rsyslogd %s startup, module path '%s', cwd:%s\n",
+ VERSION, glblModPath == NULL ? "" : (char*)glblModPath,
getcwd(cwdbuf, sizeof(cwdbuf)));
/* we are done with the initial option parsing and processing. Now we init the system. */