summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog74
-rw-r--r--doc/imklog.html13
-rw-r--r--grammar/lexer.l1
-rw-r--r--grammar/rainerscript.c18
-rw-r--r--plugins/imklog/bsd.c27
-rw-r--r--plugins/imklog/imklog.c24
-rw-r--r--plugins/imklog/imklog.h3
-rw-r--r--runtime/stream.c32
-rw-r--r--runtime/stream.h1
-rw-r--r--tests/Makefile.am3
-rwxr-xr-xtests/diag.sh9
-rwxr-xr-xtests/imptcp_addtlframedelim.sh1
-rwxr-xr-xtests/imptcp_conndrop.sh3
-rwxr-xr-xtests/imptcp_large.sh1
-rwxr-xr-xtests/imtcp_addtlframedelim.sh1
-rwxr-xr-xtests/incltest_dir_empty_wildcard.sh13
-rw-r--r--tests/testsuites/imptcp_addtlframedelim.conf1
-rw-r--r--tests/testsuites/imptcp_conndrop.conf1
-rw-r--r--tests/testsuites/imptcp_large.conf1
-rw-r--r--tests/testsuites/imtcp_addtlframedelim.conf1
-rw-r--r--tests/testsuites/incltest_dir_empty_wildcard.conf11
21 files changed, 187 insertions, 52 deletions
diff --git a/ChangeLog b/ChangeLog
index 968288ce..1ac495ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -63,7 +63,29 @@ Version 7.3.0 [devel] 2012-10-09
This was achieved by somewhat reducing the robustness of the zip archive.
This is controlled by the new action parameter "VeryReliableZip".
----------------------------------------------------------------------------
-Version 7.2.2 [v7-stable] 2012-10-??
+Version 7.2.4 [v7-stable] 2012-10-??
+- imklog: added ParseKernelTimestamp parameter (import from 5.10.2)
+ Thanks to Marius Tomaschweski for the patch.
+- imklog: added KeepKernelTimestamp parameter (import from 5.10.2)
+ Thanks to Marius Tomaschweski for the patch.
+- bugfix: imklog mistakenly took kernel timestamp subseconds as nanoseconds
+ ... actually, they are microseconds. So the fractional part of the
+ timestamp was not properly formatted. (import from 5.10.2)
+ Thanks to Marius Tomaschweski for the bug report and the patch idea.
+----------------------------------------------------------------------------
+Version 7.2.3 [v7-stable] 2012-10-21
+- regression fix: rsyslogd terminated when wild-card $IncludeConfig did not
+ find actual include files. For example, if this directive is present:
+ $IncludeConfig /etc/rsyslog.d/*.conf
+ and there are no *.conf files in /etc/rsyslog.d (but rsyslog.d exists),
+ rsyslogd will emit an error message and terminate. Previous (and expected)
+ behaviour is that an empty file set is no problem. HOWEVER, if the
+ directory itself does not exist, this is flagged as an error and will
+ load to termination (no startup).
+ Unfortunately, this is often the case by default in many distros, so this
+ actually prevents rsyslog startup.
+----------------------------------------------------------------------------
+Version 7.2.2 [v7-stable] 2012-10-16
- doc improvements
- enabled to build without libuuid, at loss of uuid functionality
this enables smoother builds on older systems that do not support
@@ -105,6 +127,14 @@ Version 7.2.2 [v7-stable] 2012-10-??
aborted on startup. Note that no segfault could happen if the initial
startup went well (this was a problem with the config parser).
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=381
+- bugfix: imfile discarded some file parts
+ File lines that were incomplete (LF missing) *at the time imfile polled
+ the file* were partially discarded. That part of the line that was read
+ without the LF was discarded, and the rest of the line was submitted in
+ the next polling cycle. This is now changed so that the partial content
+ is saved until the complete line is read. Note that the patch affects
+ only read mode 0.
+ Thanks to Milan Bartos for providing the base idea for the solution.
----------------------------------------------------------------------------
Version 7.2.1 [v7-stable] 2012-10-29
- bugfix: ruleset()-object did only support a single statement
@@ -134,13 +164,13 @@ Version 7.1.12 [beta] 2012-10-18
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.
+ Tomaschewski 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
- Tomaschwesky, Florian Piekert and Milan Bartos for their help in
+ Tomaschewski, Florian Piekert and Milan Bartos for their help in
solving this issue.
- bugfix: do not crash if set statement is used with date field
Thanks to Miloslav Trmač for the patch.
@@ -272,6 +302,23 @@ Version 6.6.1 [v6-stable] 2012-10-??
closes: http://bugzilla.adiscon.com/show_bug.cgi?id=376
The testbench was also enhanced to check for these cases.
Thanks to Georgi Georgiev for the bug report.
+- bugfix: spurios error messages from imuxsock about (non-error) EAGAIN
+ Thanks to Marius Tomaschweski for the patch.
+- imklog: added $klogParseKernelTimestamp option
+ When enabled, kernel message [timestamp] is converted for message time.
+ Default is to use receive time as in 5.8.x and before, because the clock
+ used to create the timestamp is not supposed to be as accurate as the
+ monotonic clock (depends on hardware and kernel) resulting in differences
+ between kernel and system messages which occurred at same time.
+ Thanks to Marius Tomaschweski for the patch.
+- imklog: added $klogKeepKernelTimestamp option
+ When enabled, the kernel [timestamp] remains at begin of
+ each message, even it is used for the message time too.
+ Thanks to Marius Tomaschweski for the patch.
+- bugfix: imklog mistakenly took kernel timestamp subseconds as nanoseconds
+ ... actually, they are microseconds. So the fractional part of the
+ timestamp was not properly formatted.
+ Thanks to Marius Tomaschweski for the bug report and the patch idea.
---------------------------------------------------------------------------
Version 6.6.0 [v6-stable] 2012-10-22
This starts a new stable branch, based on the 6.5.x series, plus:
@@ -336,7 +383,7 @@ all these patches here are present in 6.6.0.
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
+ Tomaschweski, Florian Piekert and Milan Bartos for their help in
solving this issue.
- change lumberjack cookie to "@cee:" from "@cee: "
CEE originally specified the cookie with SP, whereas other lumberjack
@@ -921,12 +968,27 @@ expected that interfaces, even new ones, break during the initial
---------------------------------------------------------------------------
Version 5.10.2 [V5-STABLE], 201?-??-??
- bugfix: spurios error messages from imuxsock about (non-error) EAGAIN
- Thanks to Marius Tomaschwesky for the patch.
+ Thanks to Marius Tomaschweski for the patch.
+- imklog: added $klogParseKernelTimestamp option
+ When enabled, kernel message [timestamp] is converted for message time.
+ Default is to use receive time as in 5.8.x and before, because the clock
+ used to create the timestamp is not supposed to be as accurate as the
+ monotonic clock (depends on hardware and kernel) resulting in differences
+ between kernel and system messages which occurred at same time.
+ Thanks to Marius Tomaschweski for the patch.
+- imklog: added $klogKeepKernelTimestamp option
+ When enabled, the kernel [timestamp] remains at begin of
+ each message, even it is used for the message time too.
+ Thanks to Marius Tomaschweski for the patch.
+- bugfix: imklog mistakenly took kernel timestamp subseconds as nanoseconds
+ ... actually, they are microseconds. So the fractional part of the
+ timestamp was not properly formatted.
+ Thanks to Marius Tomaschweski for the bug report and the patch idea.
---------------------------------------------------------------------------
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
+ Tomaschweski, Florian Piekert and Milan Bartos for their help in
solving this issue.
- enable DNS resolution in imrelp
Thanks to Apollon Oikonomopoulos for the patch
diff --git a/doc/imklog.html b/doc/imklog.html
index b62f4f92..0ed0e218 100644
--- a/doc/imklog.html
+++ b/doc/imklog.html
@@ -95,6 +95,19 @@ Linux only, ignored on other platforms (but may be specified)</li>
former klogd -2 option<br>
Linux only, ignored on other platforms (but may be specified)<br style="font-weight: bold;">
</li>
+<li><b>$klogParseKernelTimestamp</b> [on/<b>off</b>]
+If enabled and the kernel creates a timestamp for its log messages, this timestamp will be
+parsed and converted into regular message time instead to use the receive time of the kernel
+message (as in 5.8.x and before). Default is to not parse the kernel timestamp, because the
+clock used by the kernel to create the timestamps is not supposed to be as accurate as the
+monotonic clock required to convert it. Depending on the hardware and kernel, it can result
+in message time differences between kernel and system messages which occurred at same time.
+</li>
+<li><b>$klogKeepKernelTimestamp</b> [on/<b>off</b>]
+If enabled, this option causes to keep the [timestamp] provided by the kernel at the begin
+of in each message rather than to remove it, when it could be parsed and converted into
+local time for use as regular message time. Only used, when $klogParseKernelTimestamp is on.
+</li>
</ul>
<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>
diff --git a/grammar/lexer.l b/grammar/lexer.l
index ce7c34c5..63eaa8ce 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -88,7 +88,6 @@ extern int yydebug;
/* somehow, I need these prototype even though the headers are
* included. I guess that's some autotools magic I don't understand...
*/
-//char *strdup(char*);
int fileno(FILE *stream);
%}
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 27ff5376..0dc505a7 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -2757,6 +2757,9 @@ cnffuncNew(es_str_t *fname, struct cnffparamlst* paramlst)
return func;
}
+/* returns 0 if everything is OK and config parsing shall continue,
+ * and 1 if things are so wrong that config parsing shall be aborted.
+ */
int
cnfDoInclude(char *name)
{
@@ -2767,6 +2770,7 @@ cnfDoInclude(char *name)
glob_t cfgFiles;
struct stat fileInfo;
char nameBuf[MAXFNAME+1];
+ char cwdBuf[MAXFNAME+1];
finalName = name;
if(stat(name, &fileInfo) == 0) {
@@ -2784,14 +2788,15 @@ cnfDoInclude(char *name)
/* Silently ignore wildcards that match nothing */
if(result == GLOB_NOMATCH) {
- return 1;
+ return 0;
}
if(result == GLOB_NOSPACE || result == GLOB_ABORTED) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
- parser_errmsg("error accessing config file or directory '%s': %s",
- finalName, errStr);
+ getcwd(cwdBuf, sizeof(cwdBuf));
+ parser_errmsg("error accessing config file or directory '%s' [cwd:%s]: %s",
+ finalName, cwdBuf, errStr);
return 1;
}
@@ -2800,9 +2805,10 @@ cnfDoInclude(char *name)
if(stat(cfgFile, &fileInfo) != 0) {
char errStr[1024];
rs_strerror_r(errno, errStr, sizeof(errStr));
- parser_errmsg("error accessing config file or directory '%s': %s",
- cfgFile, errStr);
- continue;
+ getcwd(cwdBuf, sizeof(cwdBuf));
+ parser_errmsg("error accessing config file or directory '%s' "
+ "[cwd: %s]: %s", cfgFile, cwdBuf, errStr);
+ return 1;
}
if(S_ISREG(fileInfo.st_mode)) { /* config file */
diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c
index ad194b58..0fbee491 100644
--- a/plugins/imklog/bsd.c
+++ b/plugins/imklog/bsd.c
@@ -73,15 +73,18 @@ static void
submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
{
long secs;
- long nsecs;
+ long usecs;
long secOffs;
- long nsecOffs;
+ long usecOffs;
unsigned i;
unsigned bufsize;
struct timespec monotonic, realtime;
struct timeval tv;
struct timeval *tp = NULL;
+ if(!pModConf->bParseKernelStamp)
+ goto done;
+
if(buf[3] != '[')
goto done;
DBGPRINTF("imklog: kernel timestamp detected, extracting it\n");
@@ -103,9 +106,9 @@ submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
}
++i; /* skip dot */
- nsecs = 0;
+ usecs = 0;
while(buf[i] && isdigit(buf[i])) {
- nsecs = nsecs * 10 + buf[i] - '0';
+ usecs = usecs * 10 + buf[i] - '0';
++i;
}
if(buf[i] != ']') {
@@ -115,7 +118,7 @@ submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
++i; /* skip ']' */
/* we have a timestamp */
- DBGPRINTF("kernel timestamp is %ld %ld\n", secs, nsecs);
+ DBGPRINTF("kernel timestamp is %ld %ld\n", secs, usecs);
if(!pModConf->bKeepKernelStamp) {
bufsize= strlen((char*)buf);
memmove(buf+3, buf+i, bufsize - i + 1);
@@ -124,20 +127,20 @@ submitSyslog(modConfData_t *pModConf, int pri, uchar *buf)
clock_gettime(CLOCK_MONOTONIC, &monotonic);
clock_gettime(CLOCK_REALTIME, &realtime);
secOffs = realtime.tv_sec - monotonic.tv_sec;
- nsecOffs = realtime.tv_nsec - monotonic.tv_nsec;
- if(nsecOffs < 0) {
+ usecOffs = (realtime.tv_nsec - monotonic.tv_nsec) / 1000;
+ if(usecOffs < 0) {
secOffs--;
- nsecOffs += 1000000000l;
+ usecOffs += 1000000l;
}
- nsecs +=nsecOffs;
- if(nsecs > 999999999l) {
+ usecs += usecOffs;
+ if(usecs > 999999l) {
secs++;
- nsecs -= 1000000000l;
+ usecs -= 1000000l;
}
secs += secOffs;
tv.tv_sec = secs;
- tv.tv_usec = nsecs / 1000;
+ tv.tv_usec = usecs;
tp = &tv;
done:
diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c
index 6eed33fe..810ac264 100644
--- a/plugins/imklog/imklog.c
+++ b/plugins/imklog/imklog.c
@@ -77,6 +77,8 @@ DEFobjCurrIf(errmsg)
/* config settings */
typedef struct configSettings_s {
int bPermitNonKernel; /* permit logging of messages not having LOG_KERN facility */
+ int bParseKernelStamp; /* if try to parse kernel timestamps for message time */
+ int bKeepKernelStamp; /* keep the kernel timestamp in the message */
int iFacilIntMsg; /* the facility to use for internal messages (set by driver) */
uchar *pszPath;
int console_log_level; /* still used for BSD */
@@ -91,8 +93,9 @@ 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 },
+ { "parsekerneltimestamp", eCmdHdlrBinary, 0 },
+ { "keepkerneltimestamp", eCmdHdlrBinary, 0 },
{ "internalmsgfacility", eCmdHdlrFacility, 0 }
};
static struct cnfparamblk modpblk =
@@ -108,6 +111,8 @@ static inline void
initConfigSettings(void)
{
cs.bPermitNonKernel = 0;
+ cs.bParseKernelStamp = 0;
+ cs.bKeepKernelStamp = 0;
cs.console_log_level = -1;
cs.pszPath = NULL;
cs.iFacilIntMsg = klogFacilIntMsg();
@@ -287,6 +292,8 @@ CODESTARTbeginCnfLoad
/* init our settings */
pModConf->pszPath = NULL;
pModConf->bPermitNonKernel = 0;
+ pModConf->bParseKernelStamp = 0;
+ pModConf->bKeepKernelStamp = 0;
pModConf->console_log_level = -1;
pModConf->bKeepKernelStamp = 0;
pModConf->iFacilIntMsg = klogFacilIntMsg();
@@ -320,10 +327,12 @@ CODESTARTsetModCnf
loadModConf->pszPath = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(modpblk.descr[i].name, "permitnonkernelfacility")) {
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, "parsekerneltimestamp")) {
+ loadModConf->bParseKernelStamp = (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, "consoleloglevel")) {
+ loadModConf->console_log_level= (int) pvals[i].val.d.n;
} else if(!strcmp(modpblk.descr[i].name, "internalmsgfacility")) {
loadModConf->iFacilIntMsg = (int) pvals[i].val.d.n;
} else {
@@ -347,9 +356,10 @@ CODESTARTendCnfLoad
if(!loadModConf->configSetViaV2Method) {
/* persist module-specific settings from legacy config system */
loadModConf->bPermitNonKernel = cs.bPermitNonKernel;
+ loadModConf->bParseKernelStamp = cs.bParseKernelStamp;
+ loadModConf->bKeepKernelStamp = cs.bKeepKernelStamp;
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)
@@ -424,6 +434,8 @@ ENDqueryEtryPt
static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __attribute__((unused)) *pVal)
{
cs.bPermitNonKernel = 0;
+ cs.bParseKernelStamp = 0;
+ cs.bKeepKernelStamp = 0;
if(cs.pszPath != NULL) {
free(cs.pszPath);
cs.pszPath = NULL;
@@ -465,6 +477,10 @@ CODEmodInit_QueryRegCFSLineHdlr
NULL, &cs.console_log_level, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(regCfSysLineHdlr2((uchar *)"kloginternalmsgfacility", 0, eCmdHdlrFacility,
NULL, &cs.iFacilIntMsg, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2((uchar *)"klogparsekerneltimestamp", 0, eCmdHdlrBinary,
+ NULL, &cs.bParseKernelStamp, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
+ CHKiRet(regCfSysLineHdlr2((uchar *)"klogkeepkerneltimestamp", 0, eCmdHdlrBinary,
+ NULL, &cs.bKeepKernelStamp, STD_LOADABLE_MODULE_ID, &bLegacyCnfModGlobalsPermitted));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler,
resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
diff --git a/plugins/imklog/imklog.h b/plugins/imklog/imklog.h
index 6cd97c37..1cf9b05a 100644
--- a/plugins/imklog/imklog.h
+++ b/plugins/imklog/imklog.h
@@ -35,8 +35,9 @@ struct modConfData_s {
int iFacilIntMsg;
uchar *pszPath;
int console_log_level;
+ sbool bParseKernelStamp;
+ sbool bKeepKernelStamp;
sbool bPermitNonKernel;
- sbool bKeepKernelStamp; /* keep kernel timestamp instead of interpreting it */
sbool configSetViaV2Method;
};
diff --git a/runtime/stream.c b/runtime/stream.c
index 23e6c943..9f4d3556 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -596,25 +596,33 @@ strmReadLine(strm_t *pThis, cstr_t **ppCStr, int mode)
* mode = 2 LF <not whitespace> mode, a log line starts at the beginning of a line, but following lines that are indented are part of the same log entry
* This modal interface is not nearly as flexible as being able to define a regex for when a new record starts, but it's also not nearly as hard (or as slow) to implement
*/
- DEFiRet;
uchar c;
uchar finished;
+ rsRetVal readCharRet;
+ DEFiRet;
ASSERT(pThis != NULL);
ASSERT(ppCStr != NULL);
CHKiRet(cstrConstruct(ppCStr));
-
- /* now read the line */
CHKiRet(strmReadChar(pThis, &c));
- if (mode == 0){
- while(c != '\n') {
+
+ if(mode == 0) {
+ /* append previous message to current message if necessary */
+ if(pThis->prevLineSegment != NULL) {
+ CHKiRet(cstrAppendCStr(*ppCStr, pThis->prevLineSegment));
+ cstrDestruct(&pThis->prevLineSegment);
+ }
+ while(c != '\n') {
CHKiRet(cstrAppendChar(*ppCStr, c));
- CHKiRet(strmReadChar(pThis, &c));
+ readCharRet = strmReadChar(pThis, &c);
+ if(readCharRet == RS_RET_EOF) {/* end of file reached without \n? */
+ CHKiRet(rsCStrConstructFromCStr(&pThis->prevLineSegment, *ppCStr));
+ }
+ CHKiRet(readCharRet);
}
CHKiRet(cstrFinalize(*ppCStr));
- }
- if (mode == 1){
+ } else if(mode == 1) {
finished=0;
while(finished == 0){
if(c != '\n') {
@@ -635,8 +643,7 @@ strmReadLine(strm_t *pThis, cstr_t **ppCStr, int mode)
}
}
CHKiRet(cstrFinalize(*ppCStr));
- }
- if (mode == 2){
+ } else if(mode == 2) {
/* indented follow-up lines */
finished=0;
while(finished == 0){
@@ -690,6 +697,7 @@ BEGINobjConstruct(strm) /* be sure to specify the object type also in END macro!
pThis->sType = STREAMTYPE_FILE_SINGLE;
pThis->sIOBufSize = glblGetIOBufSize();
pThis->tOpenMode = 0600;
+ pThis->prevLineSegment = NULL;
ENDobjConstruct(strm)
@@ -1683,6 +1691,8 @@ static rsRetVal strmSerialize(strm_t *pThis, strm_t *pStrm)
l = pThis->iCurrOffs;
objSerializeSCALAR_VAR(pStrm, iCurrOffs, INT64, l);
+ objSerializePTR(pStrm, prevLineSegment, PSZ);
+
CHKiRet(obj.EndSerialize(pStrm));
finalize_it:
@@ -1788,6 +1798,8 @@ static rsRetVal strmSetProperty(strm_t *pThis, var_t *pProp)
CHKiRet(strmSetiFileNumDigits(pThis, pProp->val.num));
} else if(isProp("bDeleteOnClose")) {
CHKiRet(strmSetbDeleteOnClose(pThis, pProp->val.num));
+ } else if(isProp("prevLineSegment")) {
+ CHKiRet(rsCStrConstructFromCStr(&pThis->prevLineSegment, pProp->val.pStr));
}
finalize_it:
diff --git a/runtime/stream.h b/runtime/stream.h
index 91f0e4f4..b7e74074 100644
--- a/runtime/stream.h
+++ b/runtime/stream.h
@@ -144,6 +144,7 @@ typedef struct strm_s {
off_t iSizeLimit; /* file size limit, 0 = no limit */
uchar *pszSizeLimitCmd; /* command to carry out when size limit is reached */
sbool bIsTTY; /* is this a tty file? */
+ cstr_t *prevLineSegment; /* for ReadLine, previous, unwritten part of file */
} strm_t;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a673ef1e..e3226c6d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -76,6 +76,7 @@ TESTS += \
incltest.sh \
incltest_dir.sh \
incltest_dir_wildcard.sh \
+ incltest_dir_empty_wildcard.sh \
linkedlistqueue.sh
if HAVE_VALGRIND
@@ -298,6 +299,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
testsuites/incltest.conf \
incltest_dir.sh \
testsuites/incltest_dir.conf \
+ incltest_dir_empty_wildcard.sh \
+ testsuites/incltest_dir_empty_wildcard.conf \
incltest_dir_wildcard.sh \
testsuites/incltest_dir_wildcard.conf \
testsuites/incltest.d/include.conf \
diff --git a/tests/diag.sh b/tests/diag.sh
index 02b24c5b..2fdcbfb9 100755
--- a/tests/diag.sh
+++ b/tests/diag.sh
@@ -10,13 +10,12 @@
#valgrind="valgrind --tool=helgrind --log-fd=1"
#valgrind="valgrind --tool=exp-ptrcheck --log-fd=1"
#set -o xtrace
-export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout"
-export RSYSLOG_DEBUGLOG="log"
+#export RSYSLOG_DEBUG="debug nologfuncflow noprintmutexaction nostdout"
+#export RSYSLOG_DEBUGLOG="log"
case $1 in
'init') $srcdir/killrsyslog.sh # kill rsyslogd if it runs for some reason
cp $srcdir/testsuites/diag-common.conf diag-common.conf
cp $srcdir/testsuites/diag-common2.conf diag-common2.conf
- rm -f rsyslog.action.*.include
rm -f rsyslogd.started work-*.conf rsyslog.random.data
rm -f rsyslogd2.started work-*.conf
rm -f work rsyslog.out.log rsyslog2.out.log rsyslog.out.log.save # common work files
@@ -24,6 +23,10 @@ case $1 in
rm -f rsyslog.out.*.log work-presort rsyslog.pipe
rm -f rsyslog.input rsyslog.empty
rm -f core.* vgcore.*
+ # Note: rsyslog.action.*.include must NOT be deleted, as it
+ # is used to setup some parameters BEFORE calling init. This
+ # happens in chained test scripts. Delete on exit is fine,
+ # though.
mkdir test-spool
;;
'exit') rm -f rsyslogd.started work-*.conf diag-common.conf
diff --git a/tests/imptcp_addtlframedelim.sh b/tests/imptcp_addtlframedelim.sh
index b26fc85b..00276ab3 100755
--- a/tests/imptcp_addtlframedelim.sh
+++ b/tests/imptcp_addtlframedelim.sh
@@ -3,7 +3,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_addtlframedelim.sh\]: test imptcp additional frame delimiter
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imptcp_addtlframedelim.conf
source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
diff --git a/tests/imptcp_conndrop.sh b/tests/imptcp_conndrop.sh
index 684de6b5..0cf0ba5e 100755
--- a/tests/imptcp_conndrop.sh
+++ b/tests/imptcp_conndrop.sh
@@ -4,9 +4,8 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_conndrop.sh\]: test imptcp with random connection drops
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
-source $srcdir/diag.sh startup imptcp_large.conf
+source $srcdir/diag.sh startup imptcp_conndrop.conf
# 100 byte messages to gain more practical data use
source $srcdir/diag.sh tcpflood -c20 -m50000 -r -d100 -P129 -D
sleep 4 # due to large messages, we need this time for the tcp receiver to settle...
diff --git a/tests/imptcp_large.sh b/tests/imptcp_large.sh
index b4d130bb..43027069 100755
--- a/tests/imptcp_large.sh
+++ b/tests/imptcp_large.sh
@@ -4,7 +4,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imptcp_large.sh\]: test imptcp with large-size messages
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imptcp_large.conf
# send 4000 messages of 10.000bytes plus header max, randomized
diff --git a/tests/imtcp_addtlframedelim.sh b/tests/imtcp_addtlframedelim.sh
index 8de7ca58..4c1fd9cb 100755
--- a/tests/imtcp_addtlframedelim.sh
+++ b/tests/imtcp_addtlframedelim.sh
@@ -3,7 +3,6 @@
# This file is part of the rsyslog project, released under GPLv3
echo ====================================================================================
echo TEST: \[imtcp_addtlframedelim.sh\]: test imtcp additional frame delimiter
-cat rsyslog.action.1.include
source $srcdir/diag.sh init
source $srcdir/diag.sh startup imtcp_addtlframedelim.conf
source $srcdir/diag.sh tcpflood -m20000 -F0 -P129
diff --git a/tests/incltest_dir_empty_wildcard.sh b/tests/incltest_dir_empty_wildcard.sh
new file mode 100755
index 00000000..6cdb3b21
--- /dev/null
+++ b/tests/incltest_dir_empty_wildcard.sh
@@ -0,0 +1,13 @@
+# This test checks if an empty includeConfig directory causes problems. It
+# should not, as this is a valid situation that by default exists on many
+# distros.
+echo ===============================================================================
+echo \[incltest_dir_empty_wildcard.sh\]: test $IncludeConfig for \"empty\" wildcard
+source $srcdir/diag.sh init
+source $srcdir/diag.sh startup incltest_dir_empty_wildcard.conf
+# 100 messages are enough - the question is if the include is read ;)
+source $srcdir/diag.sh injectmsg 0 100
+source $srcdir/diag.sh shutdown-when-empty # shut down rsyslogd when done processing messages
+source $srcdir/diag.sh wait-shutdown
+source $srcdir/diag.sh seq-check 0 99
+source $srcdir/diag.sh exit
diff --git a/tests/testsuites/imptcp_addtlframedelim.conf b/tests/testsuites/imptcp_addtlframedelim.conf
index eb7ed0c4..bf302fb4 100644
--- a/tests/testsuites/imptcp_addtlframedelim.conf
+++ b/tests/testsuites/imptcp_addtlframedelim.conf
@@ -9,5 +9,4 @@ $template outfmt,"%msg:F,58:2%\n"
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/imptcp_conndrop.conf b/tests/testsuites/imptcp_conndrop.conf
index 677e33f6..77a5d79a 100644
--- a/tests/testsuites/imptcp_conndrop.conf
+++ b/tests/testsuites/imptcp_conndrop.conf
@@ -12,5 +12,4 @@ $template dynfile,"rsyslog.out.log" # trick to use relative path names!
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ?dynfile;outfmt
diff --git a/tests/testsuites/imptcp_large.conf b/tests/testsuites/imptcp_large.conf
index 677e33f6..77a5d79a 100644
--- a/tests/testsuites/imptcp_large.conf
+++ b/tests/testsuites/imptcp_large.conf
@@ -12,5 +12,4 @@ $template dynfile,"rsyslog.out.log" # trick to use relative path names!
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ?dynfile;outfmt
diff --git a/tests/testsuites/imtcp_addtlframedelim.conf b/tests/testsuites/imtcp_addtlframedelim.conf
index 3b4759c5..6558c519 100644
--- a/tests/testsuites/imtcp_addtlframedelim.conf
+++ b/tests/testsuites/imtcp_addtlframedelim.conf
@@ -9,5 +9,4 @@ $template outfmt,"%msg:F,58:2%\n"
$OMFileFlushOnTXEnd off
$OMFileFlushInterval 2
$OMFileIOBufferSize 256k
-$IncludeConfig rsyslog.action.1.include
local0.* ./rsyslog.out.log;outfmt
diff --git a/tests/testsuites/incltest_dir_empty_wildcard.conf b/tests/testsuites/incltest_dir_empty_wildcard.conf
new file mode 100644
index 00000000..5e750c5b
--- /dev/null
+++ b/tests/testsuites/incltest_dir_empty_wildcard.conf
@@ -0,0 +1,11 @@
+# see .sh file for description
+# rgerhards, 2009-11-30
+$IncludeConfig diag-common.conf
+
+# the following include leads to no files actually being included
+# but MUST NOT abort rsyslog's startup sequence. No files matching
+# the wildcard is valid (as long as the path exists)!
+$IncludeConfig testsuites/incltest.d/*.conf-not-there
+
+$template outfmt,"%msg:F,58:2%\n"
+:msg, contains, "msgnum:" ./rsyslog.out.log;outfmt