diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-25 09:16:41 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-25 09:16:41 +0000 |
commit | 2962bfb7abb25bfeb8d0f818826992ab7c5ac62f (patch) | |
tree | 681ff07f62c3da1911c21d7597d20e96750e4881 /msg.c | |
parent | 6b2f3da3b511c842465ea4d0826ea915cc1a11fe (diff) | |
download | rsyslog-2962bfb7abb25bfeb8d0f818826992ab7c5ac62f.tar.gz rsyslog-2962bfb7abb25bfeb8d0f818826992ab7c5ac62f.tar.bz2 rsyslog-2962bfb7abb25bfeb8d0f818826992ab7c5ac62f.zip |
added $HHOUR and $QHOUR system properties - can be used for half- and
quarter-hour logfile rotation
Diffstat (limited to 'msg.c')
-rw-r--r-- | msg.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1243,7 +1243,7 @@ char *textpri(char *pRes, size_t pResLen, int pri) * can not allocate memory, it returns a NULL pointer. * Added 2007-07-10 rgerhards */ -typedef enum ENOWType { NOW_NOW, NOW_YEAR, NOW_MONTH, NOW_DAY, NOW_HOUR, NOW_MINUTE } eNOWType; +typedef enum ENOWType { NOW_NOW, NOW_YEAR, NOW_MONTH, NOW_DAY, NOW_HOUR, NOW_HHOUR, NOW_QHOUR, NOW_MINUTE } eNOWType; #define tmpBUFSIZE 16 /* size of formatting buffer */ static uchar *getNOW(eNOWType eNow) { @@ -1272,6 +1272,12 @@ static uchar *getNOW(eNOWType eNow) case NOW_HOUR: snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour); break; + case NOW_HHOUR: + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 30); + break; + case NOW_QHOUR: + snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.hour / 15); + break; case NOW_MINUTE: snprintf((char*) pBuf, tmpBUFSIZE, "%2.2d", t.minute); break; @@ -1424,6 +1430,16 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, return "***OUT OF MEMORY***"; } else *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ + } else if(!strcmp((char*) pName, "$HHOUR")) { + if((pRes = (char*) getNOW(NOW_HHOUR)) == NULL) { + return "***OUT OF MEMORY***"; + } else + *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ + } else if(!strcmp((char*) pName, "$QHOUR")) { + if((pRes = (char*) getNOW(NOW_QHOUR)) == NULL) { + return "***OUT OF MEMORY***"; + } else + *pbMustBeFreed = 1; /* all of these functions allocate dyn. memory */ } else if(!strcmp((char*) pName, "$MINUTE")) { if((pRes = (char*) getNOW(NOW_MINUTE)) == NULL) { return "***OUT OF MEMORY***"; |