summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-10-09 17:53:16 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2013-10-09 17:53:16 +0200
commit20aa2b535e641cba43cf9219619b6f4b626b1eed (patch)
tree32beba425eb37cea0288e8fc1b9f4d278b690f95
parent12e53bc326446549a32bb52ed8255e53277ec95b (diff)
downloadrsyslog-20aa2b535e641cba43cf9219619b6f4b626b1eed.tar.gz
rsyslog-20aa2b535e641cba43cf9219619b6f4b626b1eed.tar.bz2
rsyslog-20aa2b535e641cba43cf9219619b6f4b626b1eed.zip
imudp: add "defaultTZ" input config parameter
-rw-r--r--doc/imudp.html11
-rw-r--r--plugins/imudp/imudp.c10
2 files changed, 21 insertions, 0 deletions
diff --git a/doc/imudp.html b/doc/imudp.html
index a8dbca31..5655b9e6 100644
--- a/doc/imudp.html
+++ b/doc/imudp.html
@@ -74,6 +74,17 @@ of "imudp514". The ability to append a port is most useful when multiple ports
are defined for a single input and each of the inputnames shall be unique.
Note that there currently is no differentiation between IPv4/v6 listeners on
the same port.
+<li><b>defaultTZ</b> &lt;timezone-info&gt;<br>
+This is an <b>experimental</b> parameter; details may change at any time and it may
+also be discoutinued without any early warning.<br>
+Permits to set a default timezone for this listener. This is useful when working with
+legacy syslog (RFC3164 et al) residing in different timezones. If set it will be used as
+timezone for all messages <b>that do not contain timezone info</b>.
+Currently, the format <b>must</b> be "+/-hh:mm", e.g. "-05:00", "+01:30". Other formats,
+including TZ names (like EST) are NOT yet supported. Note that consequently no daylight
+saving settings are evaluated when working with timezones. If an invalid format is used,
+"interesting" things can happen, among them malformed timestamps and rsyslogd segfaults.
+This will obviously be changed at the time this feature becomes non-experimental.</li>
</li>
</ul>
<b>Caveats/Known Bugs:</b>
diff --git a/plugins/imudp/imudp.c b/plugins/imudp/imudp.c
index e6a34f01..312d069e 100644
--- a/plugins/imudp/imudp.c
+++ b/plugins/imudp/imudp.c
@@ -78,6 +78,7 @@ static struct lstn_s {
prop_t *pInputName;
statsobj_t *stats; /* listener stats */
ratelimit_t *ratelimiter;
+ uchar *dfltTZ;
STATSCOUNTER_DEF(ctrSubmit, mutCtrSubmit)
} *lcnfRoot = NULL, *lcnfLast = NULL;
@@ -110,6 +111,7 @@ struct instanceConf_s {
uchar *pszBindRuleset; /* name of ruleset to bind to */
uchar *inputname;
ruleset_t *pBindRuleset; /* ruleset to bind listener to (use system default if unspecified) */
+ uchar *dfltTZ;
int ratelimitInterval;
int ratelimitBurst;
struct instanceConf_s *next;
@@ -143,6 +145,7 @@ static struct cnfparamblk modpblk =
/* input instance parameters */
static struct cnfparamdescr inppdescr[] = {
{ "port", eCmdHdlrArray, CNFPARAM_REQUIRED }, /* legacy: InputTCPServerRun */
+ { "defaulttz", eCmdHdlrString, 0 },
{ "inputname", eCmdHdlrGetWord, 0 },
{ "inputname.appendport", eCmdHdlrBinary, 0 },
{ "address", eCmdHdlrString, 0 },
@@ -177,6 +180,7 @@ createInstance(instanceConf_t **pinst)
inst->bAppendPortToInpname = 0;
inst->ratelimitBurst = 10000; /* arbitrary high limit */
inst->ratelimitInterval = 0; /* off */
+ inst->dfltTZ = NULL;
/* node created, let's add to config */
if(loadModConf->tail == NULL) {
@@ -261,6 +265,7 @@ addListner(instanceConf_t *inst)
newlcnfinfo->next = NULL;
newlcnfinfo->sock = newSocks[iSrc];
newlcnfinfo->pRuleset = inst->pBindRuleset;
+ newlcnfinfo->dfltTZ = inst->dfltTZ;
snprintf((char*)dispname, sizeof(dispname), "imudp(%s:%s)", bindName, port);
dispname[sizeof(dispname)-1] = '\0'; /* just to be on the save side... */
CHKiRet(ratelimitNew(&newlcnfinfo->ratelimiter, (char*)dispname, NULL));
@@ -415,6 +420,8 @@ processSocket(thrdInfo_t *pThrd, struct lstn_s *lstn, struct sockaddr_storage *f
MsgSetInputName(pMsg, lstn->pInputName);
MsgSetRuleset(pMsg, lstn->pRuleset);
MsgSetFlowControlType(pMsg, eFLOWCTL_NO_DELAY);
+ if(lstn->dfltTZ != NULL)
+ MsgSetDfltTZ(pMsg, (char*) lstn->dfltTZ);
pMsg->msgFlags = NEEDS_PARSING | PARSE_HOSTNAME | NEEDS_DNSRESOL;
if(*pbIsPermitted == 2)
pMsg->msgFlags |= NEEDS_ACLCHK_U; /* request ACL check after resolution */
@@ -721,6 +728,8 @@ createListner(es_str_t *port, struct cnfparamvals *pvals)
inst->inputname = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(inppblk.descr[i].name, "inputname.appendport")) {
inst->bAppendPortToInpname = (int) pvals[i].val.d.n;
+ } else if(!strcmp(inppblk.descr[i].name, "defaulttz")) {
+ inst->dfltTZ = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(inppblk.descr[i].name, "address")) {
inst->pszBindAddr = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(inppblk.descr[i].name, "ruleset")) {
@@ -896,6 +905,7 @@ CODESTARTfreeCnf
free(inst->pszBindPort);
free(inst->pszBindAddr);
free(inst->inputname);
+ free(inst->dfltTZ);
del = inst;
inst = inst->next;
free(del);