diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-29 18:04:12 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-03-29 18:04:12 +0200 |
commit | b88ba949f8d657034f808034321fabbd65bf8078 (patch) | |
tree | 2cf7d0c34d4e9fa6db3625d0833382d74fe7b698 /runtime/msg.c | |
parent | 3dccce084a65376b7555aec77c4cf1368cdd9cb7 (diff) | |
download | rsyslog-b88ba949f8d657034f808034321fabbd65bf8078.tar.gz rsyslog-b88ba949f8d657034f808034321fabbd65bf8078.tar.xz rsyslog-b88ba949f8d657034f808034321fabbd65bf8078.zip |
added "date-unixtimestamp" property replacer option to format as a unix timestamp
Diffstat (limited to 'runtime/msg.c')
-rw-r--r-- | runtime/msg.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index 548afb15..8f92565a 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -737,6 +737,8 @@ static inline rsRetVal msgBaseConstruct(msg_t **ppThis) pM->pszTimestamp3339[0] = '\0'; pM->pszTIMESTAMP_SecFrac[0] = '\0'; pM->pszRcvdAt_SecFrac[0] = '\0'; + pM->pszTIMESTAMP_Unix[0] = '\0'; + pM->pszRcvdAt_Unix[0] = '\0'; /* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/ @@ -1337,6 +1339,13 @@ getTimeReported(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(pM); return(pM->pszTIMESTAMP3339); + case tplFmtUnixDate: + MsgLock(pM); + if(pM->pszTIMESTAMP_Unix[0] == '\0') { + datetime.formatTimestampUnix(&pM->tTIMESTAMP, pM->pszTIMESTAMP_Unix); + } + MsgUnlock(pM); + return(pM->pszTIMESTAMP_Unix); case tplFmtSecFrac: if(pM->pszTIMESTAMP_SecFrac[0] == '\0') { MsgLock(pM); @@ -1416,6 +1425,13 @@ static inline char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt) } MsgUnlock(pM); return(pM->pszRcvdAt3339); + case tplFmtUnixDate: + MsgLock(pM); + if(pM->pszRcvdAt_Unix[0] == '\0') { + datetime.formatTimestampUnix(&pM->tRcvdAt, pM->pszRcvdAt_Unix); + } + MsgUnlock(pM); + return(pM->pszRcvdAt_Unix); case tplFmtSecFrac: if(pM->pszRcvdAt_SecFrac[0] == '\0') { MsgLock(pM); |