diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | doc/rainerscript.html | 38 | ||||
-rw-r--r-- | grammar/lexer.l | 2 | ||||
-rw-r--r-- | plugins/imuxsock/imuxsock.c | 8 | ||||
-rw-r--r-- | runtime/msg.c | 6 |
5 files changed, 29 insertions, 35 deletions
@@ -2,7 +2,17 @@ var was given --------------------------------------------------------------------------- Version 7.5.6 [devel] 2013-10-?? +- removed global variable support + The original idea was not well thought out and global variables, as + implemented, worked far different from what anybody would expect. As + such, we consider the current approach as an experiment that did not + work out and opt to removing it, clearing the way for a better future + solution. Note: global vars were introduced in 7.5.3 on Sept, 11th 2013. - imudp: support for binding to ruleset added +- bugfix: segfault if variable was assigned to non-container subtree + Thanks to Pavel Levshin for the fix +- bugfix: imuxsock did not suport addtl sockets if syssock was disabled + Thanks to Pavel Levshin for the fix - bugfix: running imupd on multiple threads lead to segfault if recvmmsg is available - bugfix: imudp when using recvmmsg could report wrong sender IP diff --git a/doc/rainerscript.html b/doc/rainerscript.html index aaaced40..0a780ac4 100644 --- a/doc/rainerscript.html +++ b/doc/rainerscript.html @@ -37,44 +37,22 @@ script interpreter when there is need to do so.<br> <h2>Variable (Property) types</h2> <p>All rsyslog properties (see the <a href="property_replacer.html">property replacer</a> page for a list) can be used in RainerScript. In addition, it also -supports local and global variables. Local variables are local to the current message, but are +supports local variables. Local variables are local to the current message, but are NOT message properties (e.g. the "$!" all JSON property does not contain -them). Global variables have a truely global scope and are NOT bound to -a specifc message. Thus they can be used to persist values across -multiple messages (for things like counters). Please note that rsyslog -ensures proper synchronization for global variables (which also means -they are slower than the others). HOWEVER, in a highly multithreaded -configuration operations like<br> -set $/var = $/var + 1;</br> -are <b>not</b> atomic, so some updates to the counter variable may be missing. The -classical sample for this is in a two-thread environment: Variable $/var is set -to 1 at the start. Now the following happens in the following order: -<ol> -<li>Thread A reads 1 from $/var and adds 1, result is 2, but not yet stored -<li>Thread B reads 1 from $/var and adds 1, result is 2, but not yet stored -<li>Thread A stores its result of 2 -<li>Thread B stores its result of 2 -</ol> -After this sequence, $/var contains the value two, which is probably not what was -expected. Rsyslog does <b>not</b> provide looking primitives for individual variables, -as this can lead to serious configuration problems if not used 100% correctly. -However, rsyslog provides (or will in the future provide) special function which -provide guaranteed atomic updates (in the sample, the end result would be three -no matter what the scheduling order is). +them). <p>Only message json (CEE/Lumberjack) properties can be modified by the "set" and "unset" statements, not any other message property. Obviously, -local and global variables are also modifieable. +local variables are also modifieable. <p>Message JSON property names start with "$!" where the bang character represents the root. -<p>Local variables names start with "$.", where the dot denotes the root. Similarly, -global variables start with "$/". -<p>Both JSON properties as well as global/local variables may contain an arbitrary +<p>Local variables names start with "$.", where the dot denotes the root. +<p>Both JSON properties as well as local variables may contain an arbitrary deep path before the final element. The bang character is always used as path -separator, no matter if it is a message property or a global/local variable. For example +separator, no matter if it is a message property or a local variable. For example "$!path1!path2!varname" is a three-level deep message property where as the very similar looking "$.path1!path2!varname" specifies a three-level -deep local variable. The similar global variables is named "$/path1!path2!varname". -The bang, slash, or dot character immediately following the +deep local variable. +The bang or dot character immediately following the dollar sign is used by rsyslog to separate the different types. <h2>configuration objects</h2> <h3>main_queue()</h3> diff --git a/grammar/lexer.l b/grammar/lexer.l index e024526a..7fdb68af 100644 --- a/grammar/lexer.l +++ b/grammar/lexer.l @@ -9,7 +9,7 @@ * cases. So while we hope that cfsysline support can be dropped some time in * the future, we will probably keep these useful constructs. * - * Copyright 2011-2012 Rainer Gerhards and Adiscon GmbH. + * Copyright 2011-2013 Rainer Gerhards and Adiscon GmbH. * * This file is part of the rsyslog runtime library. * diff --git a/plugins/imuxsock/imuxsock.c b/plugins/imuxsock/imuxsock.c index c6db8c5a..01e07524 100644 --- a/plugins/imuxsock/imuxsock.c +++ b/plugins/imuxsock/imuxsock.c @@ -155,7 +155,8 @@ static int startIndexUxLocalSockets; /* process fd from that index on (used to * suppress local logging. rgerhards 2005-08-01 * read-only after startup */ -static int nfd = 1; /* number of Unix sockets open / read-only after startup */ +static int nfd = 1; /* number of active unix sockets (socket 0 is always reserved for the system + socket, even if it is not enabled. */ static int sd_fds = 0; /* number of systemd activated sockets */ /* config vars for legacy config system */ @@ -1277,10 +1278,9 @@ BEGINactivateCnfPrePrivDrop int i; CODESTARTactivateCnfPrePrivDrop runModConf = pModConf; - if(runModConf->bOmitLocalLogging && nfd == 1) - ABORT_FINALIZE(RS_RET_OK); /* we first calculate the number of listeners so that we can - * appropriately size the listener array. + * appropriately size the listener array. Note that we will + * always allocate memory for the system log socket. */ nLstn = 0; for(inst = runModConf->root ; inst != NULL ; inst = inst->next) { diff --git a/runtime/msg.c b/runtime/msg.c index 895dbeb6..7e01b185 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -3922,6 +3922,12 @@ msgAddJSON(msg_t *pM, uchar *name, struct json_object *json) } leaf = jsonPathGetLeaf(name, ustrlen(name)); CHKiRet(jsonPathFindParent(*pjroot, name, leaf, &parent, 1)); + if (json_object_get_type(parent) != json_type_object) { + DBGPRINTF("msgAddJSON: not a container in json path," + "name is '%s'\n", name); + json_object_put(json); + ABORT_FINALIZE(RS_RET_INVLD_SETOP); + } leafnode = json_object_object_get(parent, (char*)leaf); if(leafnode == NULL) { json_object_object_add(parent, (char*)leaf, json); |