This release includes many new goodies:
Karl Kaufman made multiple changes to the the configuration file parser and added a preprocessor feature. With this comes the ability to define macros, use variable substitution and include other configuration files within configuration files.
Macro Substitution ------------------ Macro substitution in a LooperNG configuration file is triggered by "[" & "]" bookends within a config record, with the intervening text expected to match one of the three currently-defined internal macros or a defined environment variable. Where a macro substitution string is available, the bookend/macro sequence is replaced by the substitution string; if a substitution value cannot be located for the macro, then the configuration import fails (via 'die'). Available macros: FILENAME - name of the configuration file in which the macro resides MODULE_NAME - name of the LooperNG module ("module =" value). MODULE_INSTANCE - module instance name, from "input {instance}" or "output {instance}" declaration within which the macro resides. <ENV_VAR> - Any defined environment variable (e.g. LOOPER_HOME). Example macros/substitutions: [LOOPER_HOME]/conf/logfile_in.conf would translate to /opt/local/looperng/conf/logfile_in.conf [LOOPER_HOME]/log/[MODULE_INSTANCE].log could translate to /opt/local/looperng/log/logfile_in1.log Config Includes --------------- Through the 'include' directive, a LooperNG configuration file may be written to rely upon additional component configuration files. Any number of include files may be specified, so long as the resulting structure remains a valid LooperNG configuration file. Include syntax: include 'filename' Example include (taking macro substitution into account): include '[LOOPER_HOME]/conf/snmptrap_out.conf Macro Definitions ----------------- Syntax: define MACRO value define MACRO 'value' define MACRO 'value with whitespace' undef MACRO Comments: * A macro cannot be referenced for substitution prior to being defined; that is, anywhere above its 'define' statement. * A "defined" macro exists for the remainder of the configuration setup -- until undefined. * Quotes are optional for macro values, but necessary for values with whitespaces. * Macro Priority: (1) Defined macros (2) Internal macros (FILENAME, MODULE_NAME, MODULE_INSTANCE) (3) Environment variables That is, if you define a macro with a name identical to one of the internal macros or an environment variable, the defined macro will override the others. However, if you undefine a macro overriding an environment variable, the environment variable value will be used in any future substitutions.
Now you can include rules files within rules files with the '#include' command.
Inside the rules file:
#include "/opt/local/looper/rules/test1.rules" or #include "$ENV{LOOPER_HOME}/rules/test.rules"
lib/pear/DB/common.php:741: Notice[8]: Only variable references should be returned by reference
lib/pear/DB/common.php:741: Notice[8]: Only variable references should be returned by reference
lib/Template.php:106: Notice[8]: Only variables should be assigned by reference
lib/Template.php:107: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference
lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference