diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-06 12:07:53 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-10-06 12:07:53 +0200 |
commit | b849df20045ca5dfec36cdff5641e8a78d326b49 (patch) | |
tree | 7c518f7679e19ef498e81f1b7fcfea553bb67717 | |
parent | 1e53745dc9f11a90c613d177b2caba563c2b83be (diff) | |
parent | 39000a62024510cd62607200e6100e3cd7c05005 (diff) | |
download | rsyslog-b849df20045ca5dfec36cdff5641e8a78d326b49.tar.gz rsyslog-b849df20045ca5dfec36cdff5641e8a78d326b49.tar.xz rsyslog-b849df20045ca5dfec36cdff5641e8a78d326b49.zip |
Merge branch 'master' into perf
Conflicts:
ChangeLog
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | plugins/imfile/imfile.c | 1 | ||||
-rw-r--r-- | plugins/imklog/imklog.c | 1 | ||||
-rw-r--r-- | plugins/imtemplate/imtemplate.c | 1 | ||||
-rw-r--r-- | runtime/datetime.c | 2 | ||||
-rw-r--r-- | runtime/msg.c | 9 | ||||
-rw-r--r-- | tools/syslogd.c | 3 |
7 files changed, 18 insertions, 7 deletions
@@ -2,6 +2,10 @@ Version 3.21.6 [DEVEL] (rgerhards), 2008-10-?? - doc bugfix: queue doc had wrong parameter name for setting controlling worker thread shutdown period +- consolidated time calls during msg object creation, improves performance + and consistency +- bugfix: subsecond time properties generated by imfile, imklog and + internal messages could be slightly inconsistent --------------------------------------------------------------------------- Version 3.21.5 [DEVEL] (rgerhards), 2008-09-30 - performance optimization: unnecessary time() calls during message @@ -109,6 +113,10 @@ Version 3.21.0 [DEVEL] (rgerhards), 2008-07-18 see below) --------------------------------------------------------------------------- Version 3.19.12 [BETA] (rgerhards), 2008-08-25 +- bugfix: subseconds where not correctly extracted from a timestamp + if that timestamp did not contain any subsecond information (the + resulting string was garbagge but should have been "0", what it + now is). --------------------------------------------------------------------------- Version 3.19.11 [BETA] (rgerhards), 2008-08-25 This is a refresh of the beta. No beta-specific fixes have been added. diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index e8e10fca..b0211bf6 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -103,7 +103,6 @@ static rsRetVal enqLine(fileInfo_t *pInfo, cstr_t *cstrLine) pMsg->iFacility = LOG_FAC(pInfo->iFacility); pMsg->iSeverity = LOG_PRI(pInfo->iSeverity); pMsg->bParseHOSTNAME = 0; - datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */ CHKiRet(submitMsg(pMsg)); finalize_it: RETiRet; diff --git a/plugins/imklog/imklog.c b/plugins/imklog/imklog.c index 9fb2f239..84c32d11 100644 --- a/plugins/imklog/imklog.c +++ b/plugins/imklog/imklog.c @@ -106,7 +106,6 @@ enqMsg(uchar *msg, uchar* pszTag, int iFacility, int iSeverity) pMsg->iFacility = LOG_FAC(iFacility); pMsg->iSeverity = LOG_PRI(iSeverity); pMsg->bParseHOSTNAME = 0; - datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */ CHKiRet(submitMsg(pMsg)); finalize_it: diff --git a/plugins/imtemplate/imtemplate.c b/plugins/imtemplate/imtemplate.c index c391d314..366408a0 100644 --- a/plugins/imtemplate/imtemplate.c +++ b/plugins/imtemplate/imtemplate.c @@ -269,7 +269,6 @@ CODESTARTrunInput pMsg->iFacility = LOG_FAC(pri); pMsg->iSeverity = LOG_PRI(pri); pMsg->bParseHOSTNAME = 0; - getCurrTime(&(pMsg->tTIMESTAMP)); / * use the current time! * / flags |= INTERNAL_MSG; logmsg(pMsg, flags); / * some time, CHKiRet() will work here, too [today NOT!] * / * diff --git a/runtime/datetime.c b/runtime/datetime.c index 47cde8c2..20ca6191 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -582,7 +582,7 @@ int formatTimestampSecFrac(struct syslogTime *ts, char* pBuf, size_t iLenBuf) lenRet = snprintf(pBuf, iLenBuf, szFmtStr, ts->secfrac); } else { pBuf[0] = '0'; - pBuf[1] = '1'; + pBuf[1] = '\0'; lenRet = 1; } diff --git a/runtime/msg.c b/runtime/msg.c index ac387354..69296710 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -257,7 +257,16 @@ rsRetVal msgConstruct(msg_t **ppThis) pM->iRefCount = 1; pM->iSeverity = -1; pM->iFacility = -1; + + /* we initialize both timestamps to contain the current time, so that they + * are consistent. Also, this saves us from doing any further time calls just + * to obtain a timestamp. The memcpy() should not really make a difference, + * especially as I think there is no codepath currently where it would not be + * required (after I have cleaned up the pathes ;)). -- rgerhards, 2008-10-02 + */ datetime.getCurrTime(&(pM->tRcvdAt)); + memcpy(&pM->tTIMESTAMP, &pM->tRcvdAt, sizeof(struct syslogTime)); + objConstructSetObjInfo(pM); /* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/ diff --git a/tools/syslogd.c b/tools/syslogd.c index 0f6a4bd1..b576bb6d 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -914,7 +914,6 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags) pMsg->iFacility = LOG_FAC(pri); pMsg->iSeverity = LOG_PRI(pri); pMsg->bParseHOSTNAME = 0; - datetime.getCurrTime(&(pMsg->tTIMESTAMP)); /* use the current time! */ flags |= INTERNAL_MSG; /* we now check if we should print internal messages out to stderr. This was @@ -1328,7 +1327,6 @@ static int parseRFCSyslogMsg(msg_t *pMsg, int flags) */ /* TIMESTAMP */ - memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime)); if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) { if(flags & IGNDATE) { /* we need to ignore the msg data, so simply copy over reception date */ @@ -1415,7 +1413,6 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) * message. There we go from high-to low precison and are done * when we find a matching one. -- rgerhards, 2008-09-16 */ - memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime)); if(datetime.ParseTIMESTAMP3339(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) { /* we are done - parse pointer is moved by ParseTIMESTAMP3339 */; } else if(datetime.ParseTIMESTAMP3164(&(pMsg->tTIMESTAMP), &p2parse) == RS_RET_OK) { |