mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-21 09:00:41 +01:00
omfwd: new action parameter "maxErrorMessages" added
This commit is contained in:
parent
4b4ae57f8b
commit
9b273d1930
@ -1,5 +1,6 @@
|
||||
---------------------------------------------------------------------------
|
||||
Version 7.5.4 [devel] 2013-09-??
|
||||
- omfwd: new action parameter "maxErrorMessages" added
|
||||
- omfile: new module parameters to set action defaults added
|
||||
* dirCreateMode
|
||||
* fileCreateMode
|
||||
|
||||
@ -20,14 +20,14 @@ If you prefer, you can also
|
||||
a specific version of the rsyslog documentation</a>.
|
||||
<p> </p>
|
||||
|
||||
<p><b>Global Configuration Directives</b>:</p>
|
||||
<p><b>Module Parameters</b>:</p>
|
||||
<ul>
|
||||
<li><strong>Template </strong>[templateName]<br>
|
||||
sets a non-standard default template for this module.<br></li>
|
||||
|
||||
</ul>
|
||||
<p> </p>
|
||||
<p><b>Action specific Configuration Directives</b>:</p>
|
||||
<p><b>Action Parameters</b>:</p>
|
||||
<ul>
|
||||
<li><strong>Target </strong>string<br>
|
||||
Name or IP-Address of the system that shall receive messages. Any resolvable name is fine. <br></li><br>
|
||||
@ -50,6 +50,19 @@ a specific version of the rsyslog documentation</a>.
|
||||
compression mode, so pre 7.5.1 configuration will continue to work
|
||||
as expected.
|
||||
<br>The compression level is specified via the usual factor of 0 to 9, with 9 being the strongest compression (taking up most processing time) and 0 being no compression at all (taking up no extra processing time). <br></li><br>
|
||||
|
||||
<li><b>maxErrorMessages </b>integer [default 5], available since 7.5.4<br>
|
||||
This sets the maximum number of error messages that omfwd
|
||||
emits during regular operations. The reason for such an upper
|
||||
limit is that error messages are conveyed back to rsyslog's
|
||||
input message stream. So if there would be no limit, an endless
|
||||
loop could be initiated if the failing action would need to
|
||||
process its own error messages and the emit a new one. This is
|
||||
also the reason why the default is very conservatively low.
|
||||
Note that version prior to 7.5.4 did not report any error
|
||||
messages for the same reason. Also note that with the initial
|
||||
implementation only errors during UDP forwarding are logged.<br></li><br>
|
||||
|
||||
<li><b>compression.mode</b> <i>mode</i><br>
|
||||
<i>mode</i> is one of "none", "single", or "stream:always". The
|
||||
default is "none", in which no compression happens at all.
|
||||
@ -113,12 +126,11 @@ a specific version of the rsyslog documentation</a>.
|
||||
<p><b>Caveats/Known Bugs:</b></p><ul><li>None.</li></ul>
|
||||
<p><b>Sample:</b></p>
|
||||
<p>The following command sends all syslog messages to a remote server via TCP port 10514.</p>
|
||||
<textarea rows="5" cols="60">Module (load="builtin:omfwd")
|
||||
*.* action(type="omfwd"
|
||||
Target="192.168.2.11"
|
||||
Port="10514"
|
||||
Protocol="tcp"
|
||||
)
|
||||
<textarea rows="5" cols="60">action(type="omfwd"
|
||||
Target="192.168.2.11"
|
||||
Port="10514"
|
||||
Protocol="tcp"
|
||||
)
|
||||
</textarea>
|
||||
|
||||
<br><br>
|
||||
@ -165,7 +177,7 @@ Protocol="tcp"
|
||||
index</a>] [<a href="http://www.rsyslog.com/">rsyslog site</a>]</p>
|
||||
<p><font size="2">This documentation is part of the
|
||||
<a href="http://www.rsyslog.com/">rsyslog</a> project.<br>
|
||||
Copyright © 2008 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
|
||||
Copyright © 2008-2013 by <a href="http://www.gerhards.net/rainer">Rainer Gerhards</a> and
|
||||
<a href="http://www.adiscon.com/">Adiscon</a>. Released under the GNU GPL
|
||||
version 3 or higher.</font></p>
|
||||
|
||||
|
||||
@ -424,6 +424,8 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
|
||||
RS_RET_QUEUE_CRY_DISK_ONLY = -2351,/**< crypto provider only supported for disk-associated queues */
|
||||
RS_RET_NO_DATA = -2352,/**< file has no data; more a state than a real error */
|
||||
RS_RET_RELP_AUTH_FAIL = -2353,/**< RELP peer authentication failed */
|
||||
RS_RET_ERR_UDPSEND = -2354,/**< sending msg via UDP failed */
|
||||
RS_RET_LAST_ERRREPORT = -2355,/**< module does not emit more error messages as limit is reached */
|
||||
|
||||
/* RainerScript error messages (range 1000.. 1999) */
|
||||
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
|
||||
|
||||
@ -109,6 +109,7 @@ typedef struct _instanceData {
|
||||
z_stream zstrm; /* zip stream to use for tcp compression */
|
||||
uchar sndBuf[16*1024]; /* this is intensionally fixed -- see no good reason to make configurable */
|
||||
unsigned offsSndBuf; /* next free spot in send buffer */
|
||||
int errsToReport; /* (remaining) number of errors to report */
|
||||
} instanceData;
|
||||
|
||||
/* config data */
|
||||
@ -144,6 +145,7 @@ static struct cnfparamdescr actpdescr[] = {
|
||||
{ "ziplevel", eCmdHdlrInt, 0 },
|
||||
{ "compression.mode", eCmdHdlrGetWord, 0 },
|
||||
{ "compression.stream.flushontxend", eCmdHdlrBinary, 0 },
|
||||
{ "maxerrormessages", eCmdHdlrInt, 0 },
|
||||
{ "rebindinterval", eCmdHdlrInt, 0 },
|
||||
{ "streamdriver", eCmdHdlrGetWord, 0 },
|
||||
{ "streamdrivermode", eCmdHdlrInt, 0 },
|
||||
@ -329,6 +331,7 @@ ENDfreeCnf
|
||||
BEGINcreateInstance
|
||||
CODESTARTcreateInstance
|
||||
pData->offsSndBuf = 0;
|
||||
pData->errsToReport = 5;
|
||||
ENDcreateInstance
|
||||
|
||||
|
||||
@ -372,7 +375,9 @@ static rsRetVal UDPSend(instanceData *pData, char *msg, size_t len)
|
||||
struct addrinfo *r;
|
||||
int i;
|
||||
unsigned lsent = 0;
|
||||
int bSendSuccess;
|
||||
sbool bSendSuccess;
|
||||
int lasterrno;
|
||||
char errStr[1024];
|
||||
|
||||
if(pData->iRebindInterval && (pData->nXmit++ % pData->iRebindInterval == 0)) {
|
||||
dbgprintf("omfwd dropping UDP 'connection' (as configured)\n");
|
||||
@ -400,18 +405,30 @@ static rsRetVal UDPSend(instanceData *pData, char *msg, size_t len)
|
||||
bSendSuccess = RSTRUE;
|
||||
break;
|
||||
} else {
|
||||
int eno = errno;
|
||||
char errStr[1024];
|
||||
dbgprintf("sendto() error: %d = %s.\n",
|
||||
eno, rs_strerror_r(eno, errStr, sizeof(errStr)));
|
||||
lasterrno = errno;
|
||||
DBGPRINTF("sendto() error: %d = %s.\n",
|
||||
lasterrno,
|
||||
rs_strerror_r(lasterrno, errStr, sizeof(errStr)));
|
||||
}
|
||||
}
|
||||
if (lsent == len && !send_to_all)
|
||||
break;
|
||||
}
|
||||
/* finished looping */
|
||||
if (bSendSuccess == RSFALSE) {
|
||||
if(bSendSuccess == RSFALSE) {
|
||||
dbgprintf("error forwarding via udp, suspending\n");
|
||||
if(pData->errsToReport > 0) {
|
||||
rs_strerror_r(lasterrno, errStr, sizeof(errStr));
|
||||
errmsg.LogError(0, RS_RET_ERR_UDPSEND, "omfwd: error sending "
|
||||
"via udp: %s", errStr);
|
||||
if(pData->errsToReport == 1) {
|
||||
errmsg.LogError(0, RS_RET_LAST_ERRREPORT, "omfwd: "
|
||||
"max number of error message emitted "
|
||||
"- further messages will be "
|
||||
"suppressed");
|
||||
}
|
||||
--pData->errsToReport;
|
||||
}
|
||||
iRet = RS_RET_SUSPENDED;
|
||||
}
|
||||
}
|
||||
@ -866,6 +883,7 @@ setInstParamDefaults(instanceData *pData)
|
||||
pData->compressionLevel = 9;
|
||||
pData->strmCompFlushOnTxEnd = 1;
|
||||
pData->compressionMode = COMPRESS_NEVER;
|
||||
pData->errsToReport = 5;
|
||||
}
|
||||
|
||||
BEGINnewActInst
|
||||
@ -984,6 +1002,8 @@ CODESTARTnewActInst
|
||||
errmsg.LogError(0, NO_ERRCODE, "Compression requested, but rsyslogd is not compiled "
|
||||
"with compression support - request ignored.");
|
||||
# endif /* #ifdef USE_NETZIP */
|
||||
} else if(!strcmp(actpblk.descr[i].name, "maxerrormessages")) {
|
||||
pData->errsToReport = (int) pvals[i].val.d.n;
|
||||
} else if(!strcmp(actpblk.descr[i].name, "resendlastmsgonreconnect")) {
|
||||
pData->bResendLastOnRecon = (int) pvals[i].val.d.n;
|
||||
} else if(!strcmp(actpblk.descr[i].name, "template")) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user