summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-12-17 12:39:59 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-12-17 12:39:59 +0100
commit68c13f3f6a691c7f854e6fa4caff43295896dbde (patch)
treec131d2b276384339f189f29738d0a64136e15265
parentd3da845a61129c256c3e96fe144ea1dd67bac7c6 (diff)
parentcc8237736d11b54a3d6089d836da7ccb6972a29c (diff)
downloadrsyslog-68c13f3f6a691c7f854e6fa4caff43295896dbde.tar.gz
rsyslog-68c13f3f6a691c7f854e6fa4caff43295896dbde.tar.xz
rsyslog-68c13f3f6a691c7f854e6fa4caff43295896dbde.zip
Merge branch 'v4-devel' into v5-devel
Conflicts: ChangeLog configure.ac doc/imfile.html doc/manual.html plugins/imudp/imudp.c runtime/msg.h tools/syslogd.c
-rw-r--r--ChangeLog12
-rw-r--r--configure.ac52
-rw-r--r--doc/rsyslog_conf_global.html6
-rw-r--r--plugins/imudp/imudp.c41
-rw-r--r--plugins/omoracle/omoracle.c19
-rw-r--r--runtime/glbl.c26
-rw-r--r--tests/cfg4.testin52
-rw-r--r--tests/testsuites/parse1.conf1
-rw-r--r--tools/syslogd.c3
9 files changed, 130 insertions, 82 deletions
diff --git a/ChangeLog b/ChangeLog
index 275aeb22..18eb97b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,11 @@
---------------------------------------------------------------------------
Version 5.7.3 [V5-DEVEL] (rgerhards), 2010-12-??
+- added $IMUDPSchedulingPolicy and $IMUDPSchedulingPriority config settings
+- added $LocalHostName config directive
- bugfix: fixed build problems on some platforms
namely those that have 32bit atomic operations but not 64 bit ones
+- bugfix: local hostname was pulled too-early, so that some config
+ directives (namely FQDN settings) did not have any effect
---------------------------------------------------------------------------
Version 5.7.2 [V5-DEVEL] (rgerhards), 2010-11-26
- bugfix(important): problem in TLS handling could cause rsyslog to loop
@@ -578,7 +582,7 @@ increase.
- increased ompgsql performance by adapting to new transactional
output module interface
---------------------------------------------------------------------------
-Version 4.7.3 [v4-devel] (rgerhards), 2010-??-??
+Version 4.7.3 [v4-devel] (rgerhards), 2010-11-25
- added omuxsock, which permits to write message to local Unix sockets
this is the counterpart to imuxsock, enabling fast local forwarding
- added imptcp, a simplified, Linux-specific and potentielly fast
@@ -636,12 +640,6 @@ Version 4.7.0 [v4-devel] (rgerhards), 2010-04-14
Thanks for varmojfekoj for pointing me at this bug.
- imported changes from 4.5.6 and below
---------------------------------------------------------------------------
-Version 4.6.5 [v4-stable] (rgerhards), 2010-??-??
-- 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.
- Bug tracker: http://bugzilla.adiscon.com/show_bug.cgi?id=194
----------------------------------------------------------------------------
Version 4.6.6 [v4-stable] (rgerhards), 2010-11-??
- bugfix: a couple of problems that imfile had on some platforms, namely
Ubuntu (not their fault, but occured there)
diff --git a/configure.ac b/configure.ac
index c1b41115..b165afaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -522,7 +522,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" ;;
@@ -531,23 +531,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)
diff --git a/doc/rsyslog_conf_global.html b/doc/rsyslog_conf_global.html
index b71fc761..7d121a4a 100644
--- a/doc/rsyslog_conf_global.html
+++ b/doc/rsyslog_conf_global.html
@@ -162,6 +162,12 @@ Usually that should not be a big issue, as the restart-type HUP can easily be re
something along the lines of &quot;/etc/init.d/rsyslog restart&quot;.
</li>
<li><a href="rsconf1_includeconfig.html">$IncludeConfig</a></li><li>MainMsgQueueCheckpointInterval &lt;number&gt;</li>
+<li><b>$LocalHostName</b> [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+.
<li><b>$LogRSyslogStatusMessages</b> [<b>on</b>/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/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index 99b69731..947e22f9 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -79,6 +79,8 @@ static uchar *pRcvBuf = NULL; /* receive buffer (for a single packet). We use a
*/
static prop_t *pInputName = NULL; /* our inputName currently is always "imudp", and this will hold it */
static ruleset_t *pBindRuleset = NULL; /* ruleset to bind listener to (use system default if unspecified) */
+static uchar *pszSchedPolicy = NULL; /**< scheduling policy (string) */
+static int iSchedPrio = -1; /**< scheduling priority (must not be negative) */
#define TIME_REQUERY_DFLT 2
static int iTimeRequery = TIME_REQUERY_DFLT;/* how often is time to be queried inside tight recv loop? 0=always */
@@ -446,6 +448,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));
@@ -454,6 +457,40 @@ CODESTARTwillRun
net.PrintAllowedSenders(1); /* UDP */
net.HasRestrictions(UCHAR_CONSTANT("UDP"), &bDoACLCheck); /* 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)
@@ -539,6 +576,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/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/runtime/glbl.c b/runtime/glbl.c
index 278bc4e1..c7bb88a5 100644
--- a/runtime/glbl.c
+++ b/runtime/glbl.c
@@ -65,6 +65,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 */
@@ -179,14 +180,19 @@ GenerateLocalHostNameProperty(void)
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));
@@ -322,6 +328,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;
@@ -352,6 +362,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 *)"preservefqdn", 0, eCmdHdlrBinary, NULL, &bPreserveFQDN, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, NULL));
@@ -376,6 +387,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/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
+
+#*.* ~
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 3c3c2f79..19a5900c 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2868,9 +2868,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 */