Is there any way to do what I'm trying to do (gather stats across modules and report them in one message)?
David Lang On Wed, 5 Aug 2015, Botond Botyanszki wrote: > Hi David, > > Module variables are per module instance. > > If you do set_var('foo') in one block, get_var('foo') won't return the > same value in the others. > > Regards, > Botond > > ps: sorry, I lost the original email needed to reply to > > > On Mon, 3 Aug 2015 19:06:34 +0200 > Botond Botyanszki <b...@nxlog.org> wrote: > >> On Mon, 3 Aug 2015 06:25:59 -0700 (PDT) >> David Lang <da...@lang.hm> wrote: >> >>> after the first mark message is generated, and these three lines are >>> executed >>> >>> Exec set_var('logcount', 5 ); >>> Exec set_var('logcount', ( get_var('logcount') + 1 ) ); >>> Exec set_var('maxsize', size($raw_event)); >>> >>> why are these two variables undef? >> >> I just tested and it works as expected: >> >> <14>Aug 3 16:48:40 xxx @cee:{"EventTime":"2015-08-03 >> 16:48:40","Hostname":"xxx","Message":"","SeverityValue":2,"Severity":"","SourceName":"","ProcessID":13785,"EventRece >> ivedTime":"2015-08-03 >> 16:48:40","SourceModuleName":"","SourceModuleType":"","longestline":null,"logcount":null} >> <14>Aug 3 16:49:40 xxx @cee:{"EventTime":"2015-08-03 >> 16:49:40","Hostname":"xxx","Message":"","SeverityValue":2,"Severity":"","SourceName":"","ProcessID":13785,"EventRece >> ivedTime":"2015-08-03 >> 16:49:40","SourceModuleName":"","SourceModuleType":"","longestline":291,"logcount":6} >> <14>Aug 3 16:50:40 xxx @cee:{"EventTime":"2015-08-03 >> 16:50:40","Hostname":"xxx","Message":"","SeverityValue":2,"Severity":"","SourceName":"","ProcessID":13785,"EventRece >> ivedTime":"2015-08-03 >> 16:50:40","SourceModuleName":"","SourceModuleType":"","longestline":287,"logcount":6} >> >> Just to clear up possible confusion: >> >> $logcount refers to a field in the event. get_var() and set_var() operate >> with module variables that are not visible in the event data as a field >> so the following are two different things: >> Exec set_var('logcount', 42); >> vs >> Exec $logcount = 42; >> >> Regards, >> Botond > ------------------------------------------------------------------------------ _______________________________________________ nxlog-ce-users mailing list nxlog-ce-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nxlog-ce-users