From f764f24baa542796776e76bb5f22fdf9d7e32f5e Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Wed, 17 Feb 2010 15:45:56 +0100
Subject: updated rsyslog/php-syslog-ng doc, now that phpLogCon has evolved so
much
---
doc/rsyslog_php_syslog_ng.html | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/doc/rsyslog_php_syslog_ng.html b/doc/rsyslog_php_syslog_ng.html
index bf48a1eb..ed4d72fc 100644
--- a/doc/rsyslog_php_syslog_ng.html
+++ b/doc/rsyslog_php_syslog_ng.html
@@ -7,8 +7,10 @@
Written by
Rainer
Gerhards (2005-08-04)
-Note: it has been reported that this guide is somewhat outdated. Please
-use with care.
+Note: it has been reported that this guide is somewhat outdated. Please
+use with care. Also, please note that rsyslog's "native" web frontend is
+phpLogCon, which provides best integration
+and a lot of extra functionality.
Abstract
In this paper, I describe how to use
php-syslog-ng with
@@ -116,11 +118,11 @@ those unfamiliar with syslog-ng, this configuration is probably easier to set up
then switching to syslog-ng. For existing rsyslogd users, php-syslog-ng might be a nice
add-on to their logging infrastructure.
Please note that the MonitorWare family (to which rsyslog belongs) also
-offers a web-interface: phpLogCon. At the time of this writing, phpLogCon's code
-is by far not as clean as I would like it to be. Also the user-interface is
-definitely not as intutive as pp-syslog-ng. From a functionality point of view,
-however, I think it already is a bit ahead. So you might
-consider using it. I have set up a demo server.,
+offers a web-interface: phpLogCon.
+From my point of view, obviously, phpLogCon is the more natural choice for a web interface
+to be used together with rsyslog. It also offers superb functionality and provides,
+for example,native display of Windows event log entries.
+I have set up a demo server.,
You can have a peek at it
without installing anything.
Feedback Requested
--
cgit v1.2.3
From c577e9c64cec0eebf6b7c3bd964354ab90c045ae Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Mon, 22 Feb 2010 09:31:10 +0100
Subject: bugfix: message without MSG part could case a segfault
[backported from v5 commit 98d1ed504ec001728955a5bcd7916f64cd85f39f]
This actually was a "recent" regression, but I did not realize that it
was introduced by the performance optimization in v4-devel. Shame on
me for having two devel versions at the same time...
---
ChangeLog | 5 +++++
runtime/msg.c | 15 ++++++++++++---
tests/Makefile.am | 1 +
tests/testsuites/oversizeTag-1.parse1 | 5 ++---
tests/testsuites/weird.parse1 | 5 +++++
tools/syslogd.c | 6 ++----
6 files changed, 27 insertions(+), 10 deletions(-)
create mode 100644 tests/testsuites/weird.parse1
diff --git a/ChangeLog b/ChangeLog
index e9f7214f..d84a0d1c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+- bugfix: message without MSG part could case a segfault
+ [backported from v5 commit 98d1ed504ec001728955a5bcd7916f64cd85f39f]
+ This actually was a "recent" regression, but I did not realize that it
+ was introduced by the performance optimization in v4-devel. Shame on
+ me for having two devel versions at the same time...
---------------------------------------------------------------------------
Version 4.5.8 [v4-beta] (rgerhards), 2010-02-10
- enhanced doc for using PostgreSQL
diff --git a/runtime/msg.c b/runtime/msg.c
index 8e3ad314..70207075 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -1171,7 +1171,7 @@ uchar *getMSG(msg_t *pM)
if(pM == NULL)
ret = UCHAR_CONSTANT("");
else {
- if(pM->offMSG == -1)
+ if(pM->iLenMSG == 0)
ret = UCHAR_CONSTANT("");
else
ret = pM->pszRawMsg + pM->offMSG;
@@ -1947,12 +1947,20 @@ void MsgSetHOSTNAME(msg_t *pThis, uchar* pszHOSTNAME, int lenHOSTNAME)
/* set the offset of the MSG part into the raw msg buffer
+ * Note that the offset may be higher than the length of the raw message
+ * (exactly by one). This can happen if we have a message that does not
+ * contain any MSG part.
*/
void MsgSetMSGoffs(msg_t *pMsg, short offs)
{
ISOBJ_TYPE_assert(pMsg, msg);
- pMsg->iLenMSG = pMsg->iLenRawMsg - offs;
pMsg->offMSG = offs;
+ if(offs > pMsg->iLenRawMsg) {
+ assert(offs - 1 == pMsg->iLenRawMsg);
+ pMsg->iLenMSG = 0;
+ } else {
+ pMsg->iLenMSG = pMsg->iLenRawMsg - offs;
+ }
}
@@ -1986,7 +1994,8 @@ rsRetVal MsgReplaceMSG(msg_t *pThis, uchar* pszMSG, int lenMSG)
pThis->pszRawMsg = bufNew;
}
- memcpy(pThis->pszRawMsg + pThis->offMSG, pszMSG, lenMSG);
+ if(lenMSG > 0)
+ memcpy(pThis->pszRawMsg + pThis->offMSG, pszMSG, lenMSG);
pThis->pszRawMsg[lenNew] = '\0'; /* this also works with truncation! */
pThis->iLenRawMsg = lenNew;
pThis->iLenMSG = lenMSG;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7adebfac..7cc25e41 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -79,6 +79,7 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/2.parse1 \
testsuites/3.parse1 \
testsuites/oversizeTag-1.parse1 \
+ testsuites/weird.parse1 \
testsuites/date1.parse1 \
testsuites/date2.parse1 \
testsuites/date3.parse1 \
diff --git a/tests/testsuites/oversizeTag-1.parse1 b/tests/testsuites/oversizeTag-1.parse1
index 56510c63..d45ba1f2 100644
--- a/tests/testsuites/oversizeTag-1.parse1
+++ b/tests/testsuites/oversizeTag-1.parse1
@@ -1,3 +1,2 @@
-<38>Mar 27 19:06:53 source_server 0123456780123456780123456780123456789: MSG part
-38,auth,info,Mar 27 19:06:53,source_server,0123456780123456780123456780123456789,0123456780123456780123456780123456789:, MSG part
-# yet another real-life sample where we had some issues with
+<38>Mar 27 19:06:53 source_server 0123456789012345678901234567890123456789: MSG part
+38,auth,info,Mar 27 19:06:53,source_server,0123456789012345678901234567890123456789,0123456789012345678901234567890123456789:, MSG part
diff --git a/tests/testsuites/weird.parse1 b/tests/testsuites/weird.parse1
new file mode 100644
index 00000000..bc898fd4
--- /dev/null
+++ b/tests/testsuites/weird.parse1
@@ -0,0 +1,5 @@
+# some really weird samples, some of them seen in practice,
+# some other deliberately generated. The main point is that they
+# should not cause an abort...
+<14>Aug 30 23:00:05 X4711 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+14,user,info,Aug 30 23:00:05,X4711,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
diff --git a/tools/syslogd.c b/tools/syslogd.c
index db1e9428..3e6d51d3 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1198,8 +1198,6 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags)
assert(pMsg != NULL);
assert(pMsg->pszRawMsg != NULL);
lenMsg = pMsg->iLenRawMsg - (pMsg->offAfterPRI + 1);
-RUNLOG_VAR("%d", pMsg->offAfterPRI);
-RUNLOG_VAR("%d", lenMsg);
p2parse = pMsg->pszRawMsg + pMsg->offAfterPRI; /* point to start of text, after PRI */
/* Check to see if msg contains a timestamp. We start by assuming
@@ -1255,16 +1253,16 @@ RUNLOG_VAR("%d", lenMsg);
bTAGCharDetected = 0;
if(lenMsg > 0 && flags & PARSE_HOSTNAME) {
i = 0;
- while(lenMsg > 0 && (isalnum(p2parse[i]) || p2parse[i] == '.' || p2parse[i] == '.'
+ while(i < lenMsg && (isalnum(p2parse[i]) || p2parse[i] == '.' || p2parse[i] == '.'
|| p2parse[i] == '_' || p2parse[i] == '-') && i < CONF_TAG_MAXSIZE) {
bufParseHOSTNAME[i] = p2parse[i];
++i;
- --lenMsg;
}
if(i > 0 && p2parse[i] == ' ' && isalnum(p2parse[i-1])) {
/* we got a hostname! */
p2parse += i + 1; /* "eat" it (including SP delimiter) */
+ lenMsg -= i + 1;
bufParseHOSTNAME[i] = '\0';
MsgSetHOSTNAME(pMsg, bufParseHOSTNAME, i);
}
--
cgit v1.2.3
From af5fb078d48b364b20adf7e56e9869664e7424f9 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Mon, 22 Feb 2010 14:25:56 +0100
Subject: message parser fixes and testbench enhancements
- improved testbench to contain samples for totally malformed messages
which miss parts of the message content
- bugfix: some malformed messages could lead to a missing LF inside files
or some other missing parts of the template content.
- bugfix: if a message ended immediately with a hostname, the hostname
was mistakenly interpreted as TAG, and localhost be used as hostname
---
ChangeLog | 6 ++++++
runtime/datetime.c | 17 ++++++++++++-----
runtime/rsyslog.h | 2 +-
tests/testsuites/weird.parse1 | 34 +++++++++++++++++++++++++++++++++-
tools/syslogd.c | 16 ++++++++++++----
5 files changed, 64 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d84a0d1c..99f45851 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+- improved testbench to contain samples for totally malformed messages
+ which miss parts of the message content
+- bugfix: some malformed messages could lead to a missing LF inside files
+ or some other missing parts of the template content.
+- bugfix: if a message ended immediately with a hostname, the hostname
+ was mistakenly interpreted as TAG, and localhost be used as hostname
- bugfix: message without MSG part could case a segfault
[backported from v5 commit 98d1ed504ec001728955a5bcd7916f64cd85f39f]
This actually was a "recent" regression, but I did not realize that it
diff --git a/runtime/datetime.c b/runtime/datetime.c
index 6160bd7c..7b0d8d11 100644
--- a/runtime/datetime.c
+++ b/runtime/datetime.c
@@ -291,11 +291,11 @@ ParseTIMESTAMP3339(struct syslogTime *pTime, uchar** ppszTS, int *pLenStr)
}
/* OK, we actually have a 3339 timestamp, so let's indicated this */
- if(lenStr > 0 && *pszTS == ' ') {
+ if(lenStr > 0) {
+ if(*pszTS != ' ') /* if it is not a space, it can not be a "good" time - 2010-02-22 rgerhards */
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ ++pszTS; /* just skip past it */
--lenStr;
- ++pszTS;
- } else {
- ABORT_FINALIZE(RS_RET_INVLD_TIME);
}
/* we had success, so update parse pointer and caller-provided timestamp */
@@ -510,6 +510,7 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, uchar** ppszTS, int *pLenStr)
if(lenStr == 0 || *pszTS++ != ' ')
ABORT_FINALIZE(RS_RET_INVLD_TIME);
+ --lenStr;
/* we accept a slightly malformed timestamp when receiving. This is
* we accept one-digit days
@@ -565,7 +566,13 @@ ParseTIMESTAMP3164(struct syslogTime *pTime, uchar** ppszTS, int *pLenStr)
* invalid format, it occurs frequently enough (e.g. with Cisco devices)
* to permit it as a valid case. -- rgerhards, 2008-09-12
*/
- if(lenStr == 0 || *pszTS++ == ':') {
+ if(lenStr > 0 && *pszTS == ':') {
+ ++pszTS; /* just skip past it */
+ --lenStr;
+ }
+ if(lenStr > 0) {
+ if(*pszTS != ' ') /* if it is not a space, it can not be a "good" time - 2010-02-22 rgerhards */
+ ABORT_FINALIZE(RS_RET_INVLD_TIME);
++pszTS; /* just skip past it */
--lenStr;
}
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index 27bea6bc..0f489a7f 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -35,7 +35,7 @@
* value to the fixed size of the message object.
*/
#define CONF_TAG_MAXSIZE 512 /* a value that is deemed far too large for any valid TAG */
-#define CONF_TAG_HOSTNAME 512 /* a value that is deemed far too large for any valid HOSTNAME */
+#define CONF_HOSTNAME_MAXSIZE 512 /* a value that is deemed far too large for any valid HOSTNAME */
#define CONF_RAWMSG_BUFSIZE 101
#define CONF_TAG_BUFSIZE 32
#define CONF_HOSTNAME_BUFSIZE 32
diff --git a/tests/testsuites/weird.parse1 b/tests/testsuites/weird.parse1
index bc898fd4..e8b90c74 100644
--- a/tests/testsuites/weird.parse1
+++ b/tests/testsuites/weird.parse1
@@ -2,4 +2,36 @@
# some other deliberately generated. The main point is that they
# should not cause an abort...
<14>Aug 30 23:00:05 X4711 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-14,user,info,Aug 30 23:00:05,X4711,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+14,user,info,Aug 30 23:00:05,X4711,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
+# important: the following line has a SP at the end of the line!
+<14>Aug 30 23:00:05 X4711
+14,user,info,Aug 30 23:00:05,X4711,,,
+# and this one NOT
+<14>Aug 30 23:00:05 X4711
+14,user,info,Aug 30 23:00:05,X4711,,,
+# there is a SP at the end of the line
+<14>Aug 30 23:00:05
+14,user,info,Aug 30 23:00:05,localhost,,,
+# and here is no SP at the end of the line
+<14>Aug 30 23:00:05
+14,user,info,Aug 30 23:00:05,localhost,,,
+# unfortunately, I can not test missing dates with this test suite, because
+# we would have the current date in the response, which we can not check against
+#
+# and now the same tests with RFC3339 data - this can make a difference
+# as a different date parser is involved.
+#
+<14>2010-08-30T23:00:05Z X4711 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+14,user,info,Aug 30 23:00:05,X4711,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
+# important: the following line has a SP at the end of the line!
+<14>2010-08-30T23:00:05Z X4711
+14,user,info,Aug 30 23:00:05,X4711,,,
+# and this one NOT
+<14>2010-08-30T23:00:05Z X4711
+14,user,info,Aug 30 23:00:05,X4711,,,
+# there is a SP at the end of the line
+<14>2010-08-30T23:00:05Z
+14,user,info,Aug 30 23:00:05,localhost,,,
+# and here is no SP at the end of the line
+<14>2010-08-30T23:00:05Z
+14,user,info,Aug 30 23:00:05,localhost,,,
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 3e6d51d3..caab1691 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -1192,12 +1192,12 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags)
int bTAGCharDetected;
int i; /* general index for parsing */
uchar bufParseTAG[CONF_TAG_MAXSIZE];
- uchar bufParseHOSTNAME[CONF_TAG_HOSTNAME];
+ uchar bufParseHOSTNAME[CONF_HOSTNAME_MAXSIZE];
BEGINfunc
assert(pMsg != NULL);
assert(pMsg->pszRawMsg != NULL);
- lenMsg = pMsg->iLenRawMsg - (pMsg->offAfterPRI + 1);
+ lenMsg = pMsg->iLenRawMsg - pMsg->offAfterPRI; /* note: offAfterPRI is already the number of PRI chars (do not add one!) */
p2parse = pMsg->pszRawMsg + pMsg->offAfterPRI; /* point to start of text, after PRI */
/* Check to see if msg contains a timestamp. We start by assuming
@@ -1254,12 +1254,20 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags)
if(lenMsg > 0 && flags & PARSE_HOSTNAME) {
i = 0;
while(i < lenMsg && (isalnum(p2parse[i]) || p2parse[i] == '.' || p2parse[i] == '.'
- || p2parse[i] == '_' || p2parse[i] == '-') && i < CONF_TAG_MAXSIZE) {
+ || p2parse[i] == '_' || p2parse[i] == '-') && i < (CONF_HOSTNAME_MAXSIZE - 1)) {
bufParseHOSTNAME[i] = p2parse[i];
++i;
}
- if(i > 0 && p2parse[i] == ' ' && isalnum(p2parse[i-1])) {
+ if(i == lenMsg) {
+ /* we have a message that is empty immediately after the hostname,
+ * but the hostname thus is valid! -- rgerhards, 2010-02-22
+ */
+ p2parse += i;
+ lenMsg -= i;
+ bufParseHOSTNAME[i] = '\0';
+ MsgSetHOSTNAME(pMsg, bufParseHOSTNAME, i);
+ } else if(i > 0 && p2parse[i] == ' ' && isalnum(p2parse[i-1])) {
/* we got a hostname! */
p2parse += i + 1; /* "eat" it (including SP delimiter) */
lenMsg -= i + 1;
--
cgit v1.2.3
From 605701700a8914ebaff283193756a6e57d7d575b Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Tue, 23 Feb 2010 14:10:38 +0100
Subject: doc update: added link to "rsyslog cookbook"
---
doc/manual.html | 1 +
1 file changed, 1 insertion(+)
diff --git a/doc/manual.html b/doc/manual.html
index f258686e..50dd5b0f 100644
--- a/doc/manual.html
+++ b/doc/manual.html
@@ -45,6 +45,7 @@ if you do not read the doc, but doing so will definitely improve your experience
backgrounder on
generic syslog application design
description of rsyslog modules
+the rsyslog "cookbook" - a set of configurations ready to use
We have some in-depth papers on
--
cgit v1.2.3
From 8e027749b9f95a84619568c42d47c5dc78cf5b6a Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Wed, 24 Feb 2010 10:22:54 +0100
Subject: preparing for 4.6.0 release
---
ChangeLog | 9 +++++++++
configure.ac | 2 +-
doc/manual.html | 2 +-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 99f45851..f1aaf75c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+---------------------------------------------------------------------------
+Version 4.6.0 [v4-beta] (rgerhards), 2010-02-24
+***************************************************************************
+* This is a new stable v4 version. It contains all fixes and enhancements *
+* made during the 4.5.x phase as well as those listed below. *
+* Note: this version is scheduled to conclude the v4 development process. *
+* Do not expect any more new developments in v4. The focus is now *
+* on v5 (what also means we have a single devel branch again. *
+***************************************************************************
- improved testbench to contain samples for totally malformed messages
which miss parts of the message content
- bugfix: some malformed messages could lead to a missing LF inside files
diff --git a/configure.ac b/configure.ac
index fea6c0dd..7f8f38c3 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.5.8],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[4.6.0],[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 50dd5b0f..0e121edf 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.5.8 (v4-beta branch) of rsyslog.
+
This documentation is for version 4.6.0 (v4-stable branch) of rsyslog.
Visit the rsyslog status page
to obtain current version information and project status.
If you like rsyslog, you might
--
cgit v1.2.3
From 76ded5e98bd51d5de306f21f8abd28ee3b006be2 Mon Sep 17 00:00:00 2001
From: Rainer Gerhards
Date: Thu, 25 Feb 2010 10:09:47 +0100
Subject: doc bugfix: ChangeLog heading claimed that 4.6.0 was v4-beta
while the rest of the entry correctly said it was stable.
---
ChangeLog | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f1aaf75c..6a6ae5fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,15 @@
---------------------------------------------------------------------------
-Version 4.6.0 [v4-beta] (rgerhards), 2010-02-24
+Version 4.6.1 [v4-stable] (rgerhards), 2010-02-??
+---------------------------------------------------------------------------
+Version 4.6.0 [v4-stable] (rgerhards), 2010-02-24
***************************************************************************
* This is a new stable v4 version. It contains all fixes and enhancements *
* made during the 4.5.x phase as well as those listed below. *
* Note: this version is scheduled to conclude the v4 development process. *
* Do not expect any more new developments in v4. The focus is now *
-* on v5 (what also means we have a single devel branch again. *
+* on v5 (what also means we have a single devel branch again). *
+* ("development" means new feature development, bug fixes are of *
+* course provided for v4-stable) *
***************************************************************************
- improved testbench to contain samples for totally malformed messages
which miss parts of the message content
--
cgit v1.2.3