diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-25 09:23:31 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-03-25 09:23:31 +0000 |
commit | 752ec6ceddf2783de237bd3f1353c0926c90991b (patch) | |
tree | f435ca1b0ea8c0da7b398be5459138b9cda7b9a1 /msg.c | |
parent | db04482e56e4a815b8a36358aac6756595ed1a8e (diff) | |
download | rsyslog-752ec6ceddf2783de237bd3f1353c0926c90991b.tar.gz rsyslog-752ec6ceddf2783de237bd3f1353c0926c90991b.tar.xz rsyslog-752ec6ceddf2783de237bd3f1353c0926c90991b.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
@@ -1479,7 +1479,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) { @@ -1508,6 +1508,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; @@ -1660,6 +1666,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***"; |