From ab6e674b0bae88d3a91a30f4e32fbb857096964f Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Wed, 20 Oct 2010 16:32:33 +0200
Subject: doc/imfile: fixed small but important typo
---
doc/imfile.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/imfile.html b/doc/imfile.html
index 3687302b..89be3292 100644
--- a/doc/imfile.html
+++ b/doc/imfile.html
@@ -86,7 +86,7 @@ level may be needed. Even if you need quick response, 1 seconds should
be well enough. Please note that imfile keeps reading files as long as
there is any data in them. So a "polling sleep" will only happen when
nothing is left to be processed.
-$InputFilePollInterval [lines]
+$InputFilePersistStateInterval [lines]
Available in 4.7.3+
Specifies how often the state file shall be written when processing the input
file. The default value is 0, which means a new state file is only written when
--
cgit
From 9e6ab1494d95da61095867db209674975b1b1a2b Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 25 Nov 2010 13:56:53 +0100
Subject: preparing for 4.7.3
---
ChangeLog | 2 +-
configure.ac | 2 +-
doc/manual.html | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0fe62c5f..a266aafd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,5 @@
---------------------------------------------------------------------------
-Version 4.7.3 [v4-devel] (rgerhards), 2010-??-??
+Version 4.7.3 [v4-devel] (rgerhards), 2010-11-25
- bugfix(important): problem in TLS handling could cause rsyslog to loop
in a tight loop, effectively disabling functionality and bearing the
risk of unresponsiveness of the whole system.
diff --git a/configure.ac b/configure.ac
index f265727f..70ec65d3 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],[4.7.2],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[4.7.3],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([ChangeLog])
AC_CONFIG_MACRO_DIR([m4])
diff --git a/doc/manual.html b/doc/manual.html
index 0e4166d0..a95e8eec 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -19,7 +19,7 @@ rsyslog support available directly from the source!
Please visit the rsyslog sponsor's page
to honor the project sponsors or become one yourself! We are very grateful for any help towards the
project goals.
-This documentation is for version 4.7.2 (v4-devel branch) of rsyslog.
+
This documentation is for version 4.7.3 (v4-devel branch) of rsyslog.
Visit the rsyslog status page
to obtain current version information and project status.
If you like rsyslog, you might
--
cgit
From 91cf297043e20d2dae8b00c20efadcc388357a86 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 25 Nov 2010 14:29:02 +0100
Subject: added forgotten testcase files
---
tests/manyptcp.sh | 13 +++++++++++++
tests/testsuites/manyptcp.conf | 12 ++++++++++++
2 files changed, 25 insertions(+)
create mode 100755 tests/manyptcp.sh
create mode 100644 tests/testsuites/manyptcp.conf
diff --git a/tests/manyptcp.sh b/tests/manyptcp.sh
new file mode 100755
index 00000000..3ed5493b
--- /dev/null
+++ b/tests/manyptcp.sh
@@ -0,0 +1,13 @@
+# test many concurrent tcp connections
+echo ====================================================================================
+echo TEST: \[manyptcp.sh\]: test imptcp with large connection count
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup manyptcp.conf
+# the config file specifies exactly 1100 connections
+source $srcdir/diag.sh tcpflood -c1000 -m40000
+# the sleep below is needed to prevent too-early termination of the tcp listener
+sleep 1
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown # we need to wait until rsyslogd is finished!
+source $srcdir/diag.sh seq-check 0 39999
+source $srcdir/diag.sh exit
diff --git a/tests/testsuites/manyptcp.conf b/tests/testsuites/manyptcp.conf
new file mode 100644
index 00000000..4069f977
--- /dev/null
+++ b/tests/testsuites/manyptcp.conf
@@ -0,0 +1,12 @@
+# Test for tcp "flood" testing
+# rgerhards, 2009-04-08
+$IncludeConfig diag-common.conf
+
+$ModLoad ../plugins/imptcp/.libs/imptcp
+$MainMsgQueueTimeoutShutdown 10000
+$MaxOpenFiles 2000
+$InputPTCPServerRun 13514
+
+$template outfmt,"%msg:F,58:2%\n"
+$template dynfile,"rsyslog.out.log" # trick to use relative path names!
+:msg, contains, "msgnum:" ?dynfile;outfmt
--
cgit
From b9151f6a1708b2fb7e9518e73fcf42d86b0364a9 Mon Sep 17 00:00:00 2001
From: Chris Metcalf
Date: Thu, 25 Nov 2010 15:44:49 +0100
Subject: bugfix: atomic increment for msg object may not work correct on all
platforms.
Signed-off-by: Rainer Gerhards
---
ChangeLog | 4 ++++
runtime/msg.h | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index a266aafd..bbf900fa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
---------------------------------------------------------------------------
+Version 4.7.4 [v4-???] (rgerhards), 2010-11-??
+- bugfix: atomic increment for msg object may not work correct on all
+ platforms. Thanks to Chris Metcalf for the patch
+---------------------------------------------------------------------------
Version 4.7.3 [v4-devel] (rgerhards), 2010-11-25
- bugfix(important): problem in TLS handling could cause rsyslog to loop
in a tight loop, effectively disabling functionality and bearing the
diff --git a/runtime/msg.h b/runtime/msg.h
index cda206fc..a6923d52 100644
--- a/runtime/msg.h
+++ b/runtime/msg.h
@@ -60,9 +60,9 @@ struct msg {
flowControl_t flowCtlType; /**< type of flow control we can apply, for enqueueing, needs not to be persisted because
once data has entered the queue, this property is no longer needed. */
pthread_mutex_t mut;
+ int iRefCount; /* reference counter (0 = unused) */
bool bDoLock; /* use the mutex? */
bool bParseHOSTNAME; /* should the hostname be parsed from the message? */
- short iRefCount; /* reference counter (0 = unused) */
/* background: the hostname is not present on "regular" messages
* received via UNIX domain sockets from the same machine. However,
* it is available when we have a forwarder (e.g. rfc3195d) using local
--
cgit
From 0b18c17b2850152203ce9db648ce06212ab67157 Mon Sep 17 00:00:00 2001
From: Luis Fernando Muñoz Mejías
Date: Tue, 30 Nov 2010 13:04:58 +0100
Subject: Fix a potential missing '\0' on too long strings.
By implementing a trivial strlcpy it's much easier to detect string
truncations and react to them. This also gives a noticeable speedup in
buffer handling (can be HUGE), since strlcpy() doesn't clear all the
buffer entry before writing data.
Converted all uses of strncpy() into strlcpy().
Also, we don't need to check for some null pointers, as there are no
malloc-like operations in the doAction loop.
---
plugins/omoracle/omoracle.c | 19 +++++++++++++----
tests/cfg4.testin | 52 +++++++--------------------------------------
2 files changed, 23 insertions(+), 48 deletions(-)
diff --git a/plugins/omoracle/omoracle.c b/plugins/omoracle/omoracle.c
index 48ee1fa4..30b5834b 100644
--- a/plugins/omoracle/omoracle.c
+++ b/plugins/omoracle/omoracle.c
@@ -127,6 +127,13 @@ typedef struct _instanceData {
struct oracle_batch batch;
} instanceData;
+/* To be honest, strlcpy is faster than strncpy and makes very easy to
+ * detect if a message has been truncated. */
+#ifndef strlcpy
+#define strlcpy(dst,src,sz) snprintf((dst), (sz), "%s", (src))
+#endif
+
+
/** Database name, to be filled by the $OmoracleDB directive */
static char* db_name;
/** Database user name, to be filled by the $OmoracleDBUser
@@ -529,7 +536,7 @@ CODE_STD_FINALIZERparseSelectorAct
ENDparseSelectorAct
BEGINdoAction
- int i;
+ int i, sz;
char **params = (char**) ppString[0];
CODESTARTdoAction
@@ -540,9 +547,13 @@ CODESTARTdoAction
for (i = 0; i < pData->batch.arguments && params[i]; i++) {
dbgprintf("batch[%d][%d]=%s\n", i, pData->batch.n, params[i]);
- strncpy(pData->batch.parameters[i][pData->batch.n], params[i],
- pData->batch.param_size);
- CHKmalloc(pData->batch.parameters[i][pData->batch.n]);
+ sz = strlcpy(pData->batch.parameters[i][pData->batch.n],
+ params[i], pData->batch.param_size);
+ if (sz >= pData->batch.param_size)
+ errmsg.LogError(0, NO_ERRCODE,
+ "Possibly truncated %d column of '%s' "
+ "statement: %s", i,
+ pData->txt_statement, params[i]);
}
pData->batch.n++;
diff --git a/tests/cfg4.testin b/tests/cfg4.testin
index a49c0fb6..2dc0e830 100644
--- a/tests/cfg4.testin
+++ b/tests/cfg4.testin
@@ -12,48 +12,6 @@
# If you do not load inputs, nothing happens!
# You may need to set the module load path if modules are not found.
-#$ModLoad immark # provides --MARK-- message capability
-#$ModLoad imuxsock # provides support for local system logging (e.g. via logger command)
-#$ModLoad imklog # kernel logging (formerly provided by rklogd)
-
-# 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
-
-# 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 /rsyslog/spool # where to place spool files
-#$ActionQueueFileName uniqName # 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
# ######### Receiving Messages from Remote Hosts ##########
@@ -63,5 +21,11 @@ local7.* /var/log/boot.log
#$InputTCPServerRun 514 # start up TCP listener at port 514
# UDP Syslog Server:
-#$ModLoad imudp.so # provides UDP syslog reception
-#$UDPServerRun 514 # start a UDP syslog server at standard port 514
+$ModLoad imudp.so # provides UDP syslog reception
+$ModLoad omoracle.so
+$UDPServerRun 514 # start a UDP syslog server at standard port 514
+
+$IncludeConfig /home/munoz/logging/rsyslog/20*conf
+$IncludeConfig /home/munoz/logging/rsyslog/30*conf
+
+#*.* ~
--
cgit
From c4c20c18aae7c95c1e69c10d2ea9efbc3c2c1913 Mon Sep 17 00:00:00 2001
From: Luis Fernando Muñoz Mejías
Date: Tue, 30 Nov 2010 13:04:59 +0100
Subject: Fix the build system to build outisde CERN.
It should build against Oracle 11, too. Depending on the user's
installation, either a single ORACLE_HOME environment variable or
ORACLE_LIB_PATH and ORACLE_INCLUDE_PATH environment variables will be
needed.
---
configure.ac | 52 +++++++++++++++++++++++++++++++++++-----------------
1 file changed, 35 insertions(+), 17 deletions(-)
diff --git a/configure.ac b/configure.ac
index 70ec65d3..b5c2d1c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -487,7 +487,7 @@ AC_SUBST(PGSQL_LIBS)
# oracle (OCI) support
AC_ARG_ENABLE(oracle,
- [AS_HELP_STRING([--enable-oracle],[Enable native Oracle database support @<:@default=no@:>@])],
+ [AS_HELP_STRING([--enable-oracle],[Enable native Oracle database support @<:@default=no@:>@]. (Check your ORACLE_HOME environment variable!))],
[case "${enableval}" in
yes) enable_oracle="yes" ;;
no) enable_oracle="no" ;;
@@ -496,23 +496,41 @@ AC_ARG_ENABLE(oracle,
[enable_oracle=no]
)
if test "x$enable_oracle" = "xyes"; then
- AC_CHECK_PROG(
- [HAVE_ORACLE_CONFIG],
- [oracle-instantclient-config],
- [yes],,,
- )
- if test "x${HAVE_ORACLE_CONFIG}" != "xyes"; then
- AC_MSG_FAILURE([oracle-instantclient-config not found in PATH])
+ if test -d "$ORACLE_HOME"
+ then
+ AC_CHECK_LIB([occi], [OCIEnvCreate],
+ [ORACLE_CFLAGS=-I$ORACLE_HOME/rdbms/public]
+ [ORACLE_LIBS=-L$ORACLE_HOME/lib -locci],
+ [AC_MSG_FAILURE([Oracle (OCI) library is missing: wrong oracle home])],
+ [-I$ORACLE_HOME/rdbms/public/ -L$ORACLE_HOME/lib -locci -lclntsh ]
+ )
+ elif test -d "$ORACLE_LIB_PATH" -a -d "$ORACLE_INCLUDE_PATH"
+ then
+ AC_CHECK_LIB([occi], [OCIEnvCreate],
+ [ORACLE_CFLAGS=-I$ORACLE_INCLUDE_PATH]
+ [ORACLE_LIBS=-L$ORACLE_LIB_PATH -locci],
+ [AC_MSG_FAILURE([Oracle (OCI) library is missing: wrong oracle directories])],
+ [-I$ORACLE_INCLUDE_PATH -L$ORACLE_LIB_PATH -locci -lclntsh ]
+ )
+ else
+ AC_CHECK_PROG(
+ [HAVE_ORACLE_CONFIG],
+ [oracle-instantclient-config],
+ [yes],,,
+ )
+ if test "x${HAVE_ORACLE_CONFIG}" != "xyes"; then
+ AC_MSG_FAILURE([oracle-instantclient-config not found in PATH])
+ fi
+ AC_CHECK_LIB(
+ [occi],
+ [OCIEnvCreate],
+ [ORACLE_CFLAGS="`oracle-instantclient-config --cflags`"
+ ORACLE_LIBS="`oracle-instantclient-config --libs`"
+ ],
+ [AC_MSG_FAILURE([Oracle (OCI) libraray is missing])],
+ [`oracle-instantclient-config --libs --cflags`]
+ )
fi
- AC_CHECK_LIB(
- [occi],
- [OCIEnvCreate],
- [ORACLE_CFLAGS="`oracle-instantclient-config --cflags`"
- ORACLE_LIBS="`oracle-instantclient-config --libs`"
- ],
- [AC_MSG_FAILURE([Oracle (OCI) libraray is missing])],
- [`oracle-instantclient-config --libs --cflags`]
- )
fi
AM_CONDITIONAL(ENABLE_ORACLE, test x$enable_oracle = xyes)
AC_SUBST(ORACLE_CFLAGS)
--
cgit
From 06bad730521dc476a7eabbbedf624a4cfbf65b18 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 16 Dec 2010 13:40:23 +0100
Subject: cleanup of cosmetic nit (result of clang static code analyser run)
---
tools/syslogd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/syslogd.c b/tools/syslogd.c
index fb1c6e0e..5f8d45a8 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -3290,7 +3290,7 @@ int realMain(int argc, char **argv)
}
}
- if ((argc -= optind))
+ if(argc - optind)
usage();
DBGPRINTF("rsyslogd %s startup, compatibility mode %d, module path '%s', cwd:%s\n",
--
cgit
From 699d0d933ab64941d40df17c69b2c377231924cf Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 16 Dec 2010 15:29:20 +0100
Subject: added $LocalHostName config directive & some bugfixing
- added $LocalHostName config directive
- bugfix: local hostname was pulled too-early, so that some config
directives (namely FQDN settings) did not have any effect
---
ChangeLog | 3 +++
doc/rsyslog_conf_global.html | 6 ++++++
runtime/cfsysline.c | 3 ---
runtime/glbl.c | 27 +++++++++++++++++++--------
tests/testsuites/parse1.conf | 1 +
tools/syslogd.c | 6 +++---
6 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0982b77a..caa53b8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
---------------------------------------------------------------------------
Version 4.7.4 [v4-???] (rgerhards), 2010-11-??
+- added $LocalHostName config directive
+- bugfix: local hostname was pulled too-early, so that some config
+ directives (namely FQDN settings) did not have any effect
- bugfix: atomic increment for msg object may not work correct on all
platforms. Thanks to Chris Metcalf for the patch
---------------------------------------------------------------------------
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
index 8c1cc9a7..b58ae9c2 100644
--- a/doc/rsyslog_conf_global.html
+++ b/doc/rsyslog_conf_global.html
@@ -150,6 +150,12 @@ Usually that should not be a big issue, as the restart-type HUP can easily be re
something along the lines of "/etc/init.d/rsyslog restart".
$IncludeConfigMainMsgQueueCheckpointInterval <number>
+$LocalHostName [name] - this directive permits to overwrite the system
+hostname with the one specified in the directive. If the directive is given
+multiple times, all but the last one will be ignored. Please note that startup
+error messages may be issued with the real hostname. This is by design and not
+a bug (but one may argue if the design should be changed ;)). Available since
+4.7.4+, 5.7.3+, 6.1.3+.
$LogRSyslogStatusMessages [on/off] - If set to on (the default),
rsyslog emits message on startup and shutdown as well as when it is HUPed.
This information might be needed by some log analyzers. If set to off, no such
diff --git a/runtime/cfsysline.c b/runtime/cfsysline.c
index 5ab73184..037e9f84 100644
--- a/runtime/cfsysline.c
+++ b/runtime/cfsysline.c
@@ -953,8 +953,6 @@ finalize_it:
*/
void dbgPrintCfSysLineHandlers(void)
{
- DEFiRet;
-
cslCmd_t *pCmd;
cslCmdHdlr_t *pCmdHdlr;
linkedListCookie_t llCookieCmd;
@@ -976,7 +974,6 @@ void dbgPrintCfSysLineHandlers(void)
}
}
dbgprintf("\n");
- ENDfunc
}
diff --git a/runtime/glbl.c b/runtime/glbl.c
index 58558ed2..b396ed7c 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -64,6 +64,7 @@ static int option_DisallowWarning = 1; /* complain if message from disallowed se
static int bDisableDNS = 0; /* don't look up IP addresses of remote messages */
static prop_t *propLocalHostName = NULL;/* our hostname as FQDN - read-only after startup */
static uchar *LocalHostName = NULL;/* our hostname - read-only after startup */
+static uchar *LocalHostNameOverride = NULL;/* user-overridden hostname - read-only after startup */
static uchar *LocalFQDNName = NULL;/* our hostname as FQDN - read-only after startup */
static uchar *LocalDomain; /* our local domain name - read-only after startup */
static char **StripDomains = NULL;/* these domains may be stripped before writing logs - r/o after s.u., never touched by init */
@@ -153,17 +154,21 @@ GenerateLocalHostNameProperty(void)
uchar *pszName;
if(propLocalHostName != NULL)
- prop.Destruct(&propLocalHostName);
CHKiRet(prop.Construct(&propLocalHostName));
- if(LocalHostName == NULL)
- pszName = (uchar*) "[localhost]";
- else {
- if(GetPreserveFQDN() == 1)
- pszName = LocalFQDNName;
- else
- pszName = LocalHostName;
+ if(LocalHostNameOverride == NULL) {
+ if(LocalHostName == NULL)
+ pszName = (uchar*) "[localhost]";
+ else {
+ if(GetPreserveFQDN() == 1)
+ pszName = LocalFQDNName;
+ else
+ pszName = LocalHostName;
+ }
+ } else { /* local hostname is overriden via config */
+ pszName = LocalHostNameOverride;
}
+ DBGPRINTF("GenerateLocalHostName uses '%s'\n", pszName);
CHKiRet(prop.SetString(propLocalHostName, pszName, ustrlen(pszName)));
CHKiRet(prop.ConstructFinalize(propLocalHostName));
@@ -296,6 +301,10 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pszDfltNetstrmDrvrCertFile);
pszDfltNetstrmDrvrCertFile = NULL;
}
+ if(LocalHostNameOverride != NULL) {
+ free(LocalHostNameOverride);
+ LocalHostNameOverride = NULL;
+ }
if(pszWorkDir != NULL) {
free(pszWorkDir);
pszWorkDir = NULL;
@@ -327,6 +336,7 @@ BEGINAbstractObjClassInit(glbl, 1, OBJ_IS_CORE_MODULE) /* class, version */
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdrivercafile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrCAF, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdriverkeyfile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrKeyFile, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"defaultnetstreamdrivercertfile", 0, eCmdHdlrGetWord, NULL, &pszDfltNetstrmDrvrCertFile, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"localhostname", 0, eCmdHdlrGetWord, NULL, &LocalHostNameOverride, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"optimizeforuniprocessor", 0, eCmdHdlrBinary, NULL, &bOptimizeUniProc, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"hupisrestart", 0, eCmdHdlrBinary, NULL, &bHUPisRestart, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"preservefqdn", 0, eCmdHdlrBinary, NULL, &bPreserveFQDN, NULL));
@@ -350,6 +360,7 @@ BEGINObjClassExit(glbl, OBJ_IS_CORE_MODULE) /* class, version */
free(pszWorkDir);
if(LocalHostName != NULL)
free(LocalHostName);
+ free(LocalHostNameOverride);
if(LocalFQDNName != NULL)
free(LocalFQDNName);
objRelease(prop, CORE_COMPONENT);
diff --git a/tests/testsuites/parse1.conf b/tests/testsuites/parse1.conf
index 947a05a8..094cd762 100644
--- a/tests/testsuites/parse1.conf
+++ b/tests/testsuites/parse1.conf
@@ -2,6 +2,7 @@ $ModLoad ../plugins/omstdout/.libs/omstdout
$IncludeConfig nettest.input.conf # This picks the to be tested input from the test driver!
$ErrorMessagesToStderr off
+$LocalHostName localhost
# use a special format that we can easily parse in expect
$template expect,"%PRI%,%syslogfacility-text%,%syslogseverity-text%,%timestamp%,%hostname%,%programname%,%syslogtag%,%msg%\n"
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 5f8d45a8..058d75d8 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2302,6 +2302,9 @@ init()
legacyOptsHook();
+ /* re-generate local host name property, as the config may have changed our FQDN settings */
+ glbl.GenerateLocalHostNameProperty();
+
/* we are now done with reading the configuration. This is the right time to
* free some objects that were just needed for loading it. rgerhards 2005-10-19
*/
@@ -3566,9 +3569,6 @@ int realMain(int argc, char **argv)
if(!iConfigVerify)
CHKiRet(doGlblProcessInit());
- /* re-generate local host name property, as the config may have changed our FQDN settings */
- glbl.GenerateLocalHostNameProperty();
-
CHKiRet(mainThread());
/* do any de-init's that need to be done AFTER this comment */
--
cgit
From cc8237736d11b54a3d6089d836da7ccb6972a29c Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Fri, 17 Dec 2010 12:21:17 +0100
Subject: added $IMUDPSchedulingPolicy and $IMUDPSchedulingPriority config
settings
---
ChangeLog | 1 +
plugins/imudp/imudp.c | 42 ++++++++++++++++++++++++++++++++++++++++++
runtime/glbl.c | 1 +
3 files changed, 44 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index caa53b8c..740ed3c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
---------------------------------------------------------------------------
Version 4.7.4 [v4-???] (rgerhards), 2010-11-??
+- added $IMUDPSchedulingPolicy and $IMUDPSchedulingPriority config settings
- added $LocalHostName config directive
- bugfix: local hostname was pulled too-early, so that some config
directives (namely FQDN settings) did not have any effect
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index d76f3544..fea789ec 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -72,6 +72,8 @@ static uchar *pRcvBuf = NULL; /* receive buffer (for a single packet). We use a
* termination if we can not get it. -- rgerhards, 2007-12-27
*/
static prop_t *pInputName = NULL; /* our inputName currently is always "imudp", and this will hold it */
+static uchar *pszSchedPolicy = NULL; /**< scheduling policy (string) */
+static int iSchedPrio = -1; /**< scheduling priority (must not be negative) */
// TODO: static ruleset_t *pBindRuleset = NULL; /* ruleset to bind listener to (use system default if unspecified) */
#define TIME_REQUERY_DFLT 2
static int iTimeRequery = TIME_REQUERY_DFLT;/* how often is time to be queried inside tight recv loop? 0=always */
@@ -357,6 +359,7 @@ ENDrunInput
/* initialize and return if will run or not */
BEGINwillRun
+ struct sched_param sparam;
CODESTARTwillRun
/* we need to create the inputName property (only once during our lifetime) */
CHKiRet(prop.Construct(&pInputName));
@@ -364,6 +367,41 @@ CODESTARTwillRun
CHKiRet(prop.ConstructFinalize(pInputName));
net.PrintAllowedSenders(1); /* UDP */
+
+ if(pszSchedPolicy == NULL) {
+ if(iSchedPrio != -1) {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: scheduling policy not set, but "
+ "priority - ignoring settings");
+ }
+ } else {
+ if(iSchedPrio == -1) {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: scheduling policy set, but no "
+ "priority - ignoring settings");
+ }
+ sparam.sched_priority = iSchedPrio;
+ dbgprintf("imudp trying to set sched policy to '%s', prio %d\n",
+ pszSchedPolicy, iSchedPrio);
+ if(0) { /* trick to use conditional compilation */
+# ifdef SCHED_FIFO
+ } else if(!strcasecmp((char*)pszSchedPolicy, "fifo")) {
+ pthread_setschedparam(pthread_self(), SCHED_FIFO, &sparam);
+# endif
+# ifdef SCHED_RR
+ } else if(!strcasecmp((char*)pszSchedPolicy, "rr")) {
+ pthread_setschedparam(pthread_self(), SCHED_RR, &sparam);
+# endif
+# ifdef SCHED_OTHER
+ } else if(!strcasecmp((char*)pszSchedPolicy, "other")) {
+ pthread_setschedparam(pthread_self(), SCHED_OTHER, &sparam);
+# endif
+ } else {
+ errmsg.LogError(errno, NO_ERRCODE, "imudp: invliad scheduling policy '%s' "
+ "ignoring settings", pszSchedPolicy);
+ }
+ free(pszSchedPolicy);
+ pszSchedPolicy = NULL;
+ }
+
/* if we could not set up any listners, there is no point in running... */
if(udpLstnSocks == NULL)
@@ -445,6 +483,10 @@ CODEmodInit_QueryRegCFSLineHdlr
addListner, NULL, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpserveraddress", 0, eCmdHdlrGetWord,
NULL, &pszBindAddr, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imudpschedulingpolicy", 0, eCmdHdlrGetWord,
+ NULL, &pszSchedPolicy, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"imudpschedulingpriority", 0, eCmdHdlrInt,
+ NULL, &iSchedPrio, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"udpservertimerequery", 0, eCmdHdlrInt,
NULL, &iTimeRequery, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
diff --git a/runtime/glbl.c b/runtime/glbl.c
index b396ed7c..59d1fb0f 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -154,6 +154,7 @@ GenerateLocalHostNameProperty(void)
uchar *pszName;
if(propLocalHostName != NULL)
+ prop.Destruct(&propLocalHostName);
CHKiRet(prop.Construct(&propLocalHostName));
if(LocalHostNameOverride == NULL) {
--
cgit