summaryrefslogtreecommitdiffstats
path: root/omfwd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-27 16:55:40 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-27 16:55:40 +0000
commit1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e (patch)
tree249ec71321b657a6a37b91f1d03f4e2c4bf07697 /omfwd.c
parent8193522d85290df659d8c2e505e8c47f39db9267 (diff)
downloadrsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.tar.gz
rsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.tar.xz
rsyslog-1d96a98daf4ac4c4ec9e664e328f1aac4bf6af9e.zip
- added omsr object (objomsr.c, objomsr.h) - template request for output
modules - changed doAction() interface - templates and output string generation for doActon() is now fully
Diffstat (limited to 'omfwd.c')
-rw-r--r--omfwd.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/omfwd.c b/omfwd.c
index 84436381..83409201 100644
--- a/omfwd.c
+++ b/omfwd.c
@@ -602,7 +602,7 @@ CODESTARTdoAction
dprintf("Not sending message to remote.\n");
else {
pData->ttSuspend = time(NULL);
- psz = (char*) pMsg;
+ psz = (char*) ppString[0];
l = strlen((char*) psz);
if (l > MAXLINE)
l = MAXLINE;
@@ -710,10 +710,8 @@ BEGINparseSelectorAct
int error;
int bErr;
struct addrinfo hints, *res;
- char szTemplateName[128];
CODESTARTparseSelectorAct
- p = *pp;
-
+CODE_STD_STRING_REQUESTparseSelectorAct(1)
if(*p == '@') {
if((iRet = createInstance(&pData)) != RS_RET_OK)
return iRet;
@@ -828,21 +826,20 @@ CODESTARTparseSelectorAct
++p;
}
+ /* TODO: make this if go away! */
if(*p == ';') {
*p = '\0'; /* trick to obtain hostname (later)! */
- ++p;
- /* Now look for the template! */
- cflineParseTemplateName(&p, szTemplateName,
- sizeof(szTemplateName) / sizeof(char));
+ strcpy(pData->f_hname, (char*) q);
+ *p = ';';
} else
- szTemplateName[0] = '\0';
- if(szTemplateName[0] == '\0') {
- /* we do not have a template, so let's use the default */
- strcpy(szTemplateName, " StdFwdFmt");
- }
+ strcpy(pData->f_hname, (char*) q);
+
+ /* process template */
+ if((iRet = cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS, (uchar*) " StdFwdFmt"))
+ != RS_RET_OK)
+ return iRet;
/* first set the pData->eDestState */
- strcpy(pData->f_hname, (char*) q);
memset(&hints, 0, sizeof(hints));
/* port must be numeric, because config file syntax requests this */
hints.ai_flags = AI_NUMERICSERV;
@@ -857,12 +854,6 @@ CODESTARTparseSelectorAct
pData->f_addr = res;
}
- /* then try to find the template */
- if((iRet = cflineSetTemplateAndIOV(f, szTemplateName)) == RS_RET_OK) {
- dprintf("forwarding host: '%s:%s/%s' template '%s'\n", q, getFwdSyslogPt(pData),
- pData->protocol == FORW_UDP ? "udp" : "tcp",
- szTemplateName);
- }
/*
* Otherwise the host might be unknown due to an
* inaccessible nameserver (perhaps on the same