summaryrefslogtreecommitdiffstats
path: root/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-03 11:06:46 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-03 11:06:46 +0000
commit83b91cb8940986b365d58b04fe633fe396ff5d6b (patch)
tree2fed11b7eb3e50170f2ef8556e216300a247db07 /msg.c
parentf500fbf50508c9c82d343a8ef6196ca25447402c (diff)
downloadrsyslog-83b91cb8940986b365d58b04fe633fe396ff5d6b.tar.gz
rsyslog-83b91cb8940986b365d58b04fe633fe396ff5d6b.tar.xz
rsyslog-83b91cb8940986b365d58b04fe633fe396ff5d6b.zip
adding sur5r's postgres module - many thanks for providing it! There are a
number of patches necessary to core modules, because we need a new formatting function (date-pgsql).
Diffstat (limited to 'msg.c')
-rw-r--r--msg.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/msg.c b/msg.c
index 2cfa592d..a2f47975 100644
--- a/msg.c
+++ b/msg.c
@@ -536,6 +536,18 @@ char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
}
MsgUnlock();
return(pM->pszTIMESTAMP_MySQL);
+ case tplFmtPgSQLDate:
+ MsgLock();
+ if(pM->pszTIMESTAMP_PgSQL == NULL) {
+ if((pM->pszTIMESTAMP_PgSQL = malloc(21)) == NULL) {
+ glblHadMemShortage = 1;
+ MsgUnlock();
+ return "";
+ }
+ formatTimestampToPgSQL(&pM->tTIMESTAMP, pM->pszTIMESTAMP_PgSQL, 21);
+ }
+ MsgUnlock();
+ return(pM->pszTIMESTAMP_PgSQL);
case tplFmtRFC3164Date:
MsgLock();
if(pM->pszTIMESTAMP3164 == NULL) {
@@ -554,7 +566,7 @@ char *getTimeReported(msg_t *pM, enum tplFormatTypes eFmt)
if((pM->pszTIMESTAMP3339 = malloc(33)) == NULL) {
glblHadMemShortage = 1;
MsgUnlock();
- return "";
+ return ""; /* TODO: check this: can it cause a free() of constant memory?) */
}
formatTimestamp3339(&pM->tTIMESTAMP, pM->pszTIMESTAMP3339, 33);
}
@@ -594,6 +606,18 @@ char *getTimeGenerated(msg_t *pM, enum tplFormatTypes eFmt)
}
MsgUnlock();
return(pM->pszRcvdAt_MySQL);
+ case tplFmtPgSQLDate:
+ MsgLock();
+ if(pM->pszRcvdAt_PgSQL == NULL) {
+ if((pM->pszRcvdAt_PgSQL = malloc(21)) == NULL) {
+ glblHadMemShortage = 1;
+ MsgUnlock();
+ return "";
+ }
+ formatTimestampToPgSQL(&pM->tRcvdAt, pM->pszRcvdAt_PgSQL, 21);
+ }
+ MsgUnlock();
+ return(pM->pszRcvdAt_PgSQL);
case tplFmtRFC3164Date:
MsgLock();
if(pM->pszRcvdAt3164 == NULL) {