summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-08-13 15:02:50 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-08-13 15:02:50 +0200
commit1a7bf0ceaa792c580a726db831c749b80376e243 (patch)
tree222e63ba69d6bc3b3e53713c6f19b259e0d01360
parentd7bc0f1f1e81ca0fa678b945962574112df949bc (diff)
parenta61e548958044f9efa013b5911d130ae1930448f (diff)
downloadrsyslog-1a7bf0ceaa792c580a726db831c749b80376e243.tar.gz
rsyslog-1a7bf0ceaa792c580a726db831c749b80376e243.tar.xz
rsyslog-1a7bf0ceaa792c580a726db831c749b80376e243.zip
Merge branch 'beta'
Conflicts: plugins/imuxsock/imuxsock.c
-rw-r--r--ChangeLog20
-rw-r--r--doc/ommysql.html46
-rw-r--r--doc/rsyslog_conf.html2
-rw-r--r--plugins/ommysql/ommysql.c24
-rw-r--r--tools/syslogd.c2
5 files changed, 88 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index f707deec..01d0d76c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@ Version 3.21.0 [DEVEL] (rgerhards), 2008-07-18
see below)
---------------------------------------------------------------------------
Version 3.19.11 [BETA] (rgerhards), 2008-??-??
+- included fixes from v3-stable
---------------------------------------------------------------------------
Version 3.19.10 [BETA] (rgerhards), 2008-07-15
- start of a new beta branch based on former 3.19 devel branch
@@ -206,7 +207,24 @@ Version 3.19.0 (rgerhards), 2008-05-06
- a lot of cleanup in regard to modularization
- -c option no longer must be the first option - thanks to varmjofekoj
for the patch
-Version 3.18.2 (rgerhards), 2008-07-??
+---------------------------------------------------------------------------
+Version 3.18.3 (rgerhards), 2008-08-??
+- enhanced ommysql to support custom port to connect to server
+ Port can be set via new $ActionOmmysqlServerPort config directive
+ Note: this was a very minor change and thus deemed appropriate to be
+ done in the stable release.
+- bugfix: misspelled config directive, previously was
+ $MainMsgQueueWorkeTimeoutrThreadShutdown, is now
+ $MainMsgQueueWorkerTimeoutThreadShutdown. Note that the misspelled
+ directive is not preserved - if the misspelled directive was used
+ (which I consider highly unlikely), the config file must be changed.
+ Thanks to lperr for reporting the bug.
+- disabled flow control for imuxsock, as it could cause system hangs
+ under some circumstances. The devel (3.21.3 and above) will
+ re-enable it and provide enhanced configurability to overcome the
+ problems if they occur.
+---------------------------------------------------------------------------
+Version 3.18.2 (rgerhards), 2008-08-08
- merged in IPv6 forwarding address bugfix from v2-stable
---------------------------------------------------------------------------
Version 3.18.1 (rgerhards), 2008-07-21
diff --git a/doc/ommysql.html b/doc/ommysql.html
new file mode 100644
index 00000000..79d913eb
--- /dev/null
+++ b/doc/ommysql.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html><head>
+<meta http-equiv="Content-Language" content="en">
+<title>MySQL Database Output Module</title>
+</head>
+
+<body>
+<h1>MySQL Database Output Module</h1>
+<p><b>Module Name:&nbsp;&nbsp;&nbsp; ommysql</b></p>
+<p><b>Author: </b>Michael Meckelein (Initial Author) / Rainer Gerhards
+&lt;rgerhards@adiscon.com&gt;</p>
+<p><b>Description</b>:</p>
+<p>This module provides native support for logging to MySQL databases. It offers
+superior performance over the more generic <a href="omlibdbi.html">omlibdbi</a> module.
+</p>
+<p><b>Configuration Directives</b>:</p>
+<p>ommysql mostly uses the "old style" configuration, with almost everything on the
+action line itself. A few newer features are being migrated to the new style-config
+directive configuration system.
+<ul>
+<li><b>$ActionOmmysqlServerPort &lt;port&gt;</b><br>Permits to select
+a non-standard port for the MySQL server. The default is 0, which means the
+system default port is used. There is no need to specify this directive unless
+you know the server is running on a non-standard listen port.
+<li>Action parameters:
+<br><b>:ommysql:database-server,database-name,database-userid,database-password</b>
+<br>All parameters should be filled in for a successful connect.
+</ul>
+<p><b>Sample:</b></p>
+<p>The following sample writes all syslog messages to the
+database "syslog_db" on mysqlsever.example.com. The server is
+being accessed under the account of "user" with password "pwd".
+</p>
+<textarea rows="5" cols="80">$ModLoad ommysql
+$ActionOmmysqlServerPort 1234 # use non-standard port
+*.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :ommysql:mysqlserver.example.com,syslog_db,user,pwd
+</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 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
+<a href="http://www.adiscon.com/">Adiscon</a>.
+Released under the GNU GPL version 3 or higher.</font></p>
+</body></html>
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index ac97ecb1..aab30f5e 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -30,7 +30,7 @@ trap output module</li>
<li><a href="omrelp.html">omrelp</a> - RELP
output module</li>
<li>omgss - output module for GSS-enabled syslog</li>
-<li>ommysql - output module for MySQL</li>
+<li><a href="ommysql.html">ommysql</a> - output module for MySQL</li>
<li>ompgsql - output module for PostgreSQL</li>
<li><a href="omlibdbi.html">omlibdbi</a> -
generic database output module (Firebird/Interbase, MS SQL, Sybase,
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index e69ab40b..22abb1d2 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -44,6 +44,7 @@
#include "ommysql.h"
#include "module-template.h"
#include "errmsg.h"
+#include "cfsysline.h"
MODULE_TYPE_OUTPUT
@@ -55,12 +56,16 @@ DEFobjCurrIf(errmsg)
typedef struct _instanceData {
MYSQL *f_hmysql; /* handle to MySQL */
char f_dbsrv[MAXHOSTNAMELEN+1]; /* IP or hostname of DB server*/
+ unsigned int f_dbsrvPort; /* port of MySQL server */
char f_dbname[_DB_MAXDBLEN+1]; /* DB name */
char f_dbuid[_DB_MAXUNAMELEN+1]; /* DB user */
char f_dbpwd[_DB_MAXPWDLEN+1]; /* DB user's password */
unsigned uLastMySQLErrno; /* last errno returned by MySQL or 0 if all is well */
} instanceData;
+/* config variables */
+static int iSrvPort = 0; /* database server port */
+
BEGINcreateInstance
CODESTARTcreateInstance
@@ -150,7 +155,7 @@ static rsRetVal initMySQL(instanceData *pData, int bSilent)
} else { /* we could get the handle, now on with work... */
/* Connect to database */
if(mysql_real_connect(pData->f_hmysql, pData->f_dbsrv, pData->f_dbuid,
- pData->f_dbpwd, pData->f_dbname, 0, NULL, 0) == NULL) {
+ pData->f_dbpwd, pData->f_dbname, pData->f_dbsrvPort, NULL, 0) == NULL) {
reportDBError(pData, bSilent);
closeMySQL(pData); /* ignore any error we may get */
iRet = RS_RET_SUSPENDED;
@@ -273,6 +278,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
errmsg.LogError(0, RS_RET_INVALID_PARAMS, "Trouble with MySQL connection properties. -MySQL logging disabled");
ABORT_FINALIZE(RS_RET_INVALID_PARAMS);
} else {
+ pData->f_dbsrvPort = (unsigned) iSrvPort; /* set configured port */
pData->f_hmysql = NULL; /* initialize, but connect only on first message (important for queued mode!) */
}
@@ -291,12 +297,24 @@ CODEqueryEtryPt_STD_OMOD_QUERIES
ENDqueryEtryPt
+/* Reset config variables for this module to default values.
+ */
+static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
+{
+ DEFiRet;
+ iSrvPort = 0; /* zero is the default port */
+ RETiRet;
+}
+
BEGINmodInit()
CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+ /* register our config handlers */
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &iSrvPort, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
-/*
- * vi:set ai:
+
+/* vi:set ai:
*/
diff --git a/tools/syslogd.c b/tools/syslogd.c
index ad28ff22..758d5ed1 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -2698,7 +2698,7 @@ static rsRetVal loadBuildInModules(void)
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoQShutdown, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutactioncompletion", 0, eCmdHdlrInt, NULL, &iMainMsgQtoActShutdown, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuetimeoutenqueue", 0, eCmdHdlrInt, NULL, &iMainMsgQtoEnq, NULL));
- CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworketimeoutrthreadshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoWrkShutdown, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkertimeoutthreadshutdown", 0, eCmdHdlrInt, NULL, &iMainMsgQtoWrkShutdown, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuedequeueslowdown", 0, eCmdHdlrInt, NULL, &iMainMsgQDeqSlowdown, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueueworkerthreadminimummessages", 0, eCmdHdlrInt, NULL, &iMainMsgQWrkMinMsgs, NULL));
CHKiRet(regCfSysLineHdlr((uchar *)"mainmsgqueuemaxfilesize", 0, eCmdHdlrSize, NULL, &iMainMsgQueMaxFileSize, NULL));