Skip to content
  • Thomas Bellman's avatar
    faacbec2
    Make syslog::modload deal with RainerScript. · faacbec2
    Thomas Bellman authored
    Newer versions of rsyslog, a "scripting language" for configuring
    rsyslog, named RainerScript, has been introduced, with version 6
    the first version with full support.  RainerScript has a new way
    of loading (and configuring) modules: ``module(load="NAME" ...)''
    replaces the old $ModLoad directive.  The old syntax still works,
    and you can mix them (and there are some features as of yet only
    available using the old-style ``$'' directives).
    
    We want to be able to use the new-style declarations, so we need
    to adapt the syslog::modload definition to at least cope with the
    new syntax in existing files and not add $ModLoad directives if
    there is already a module() directive for the same module.  And
    also be able to delete module() directives for ensure=>absent.
    
    For the time being, we only change syslog::modload to recognize
    the new syntax when it exists in the file, and if we need to add
    a loading directive, the old syntax will be used, to support older
    versions of rsyslog.
    
    Our implementation is also quite limited in how module() directives
    may be formatted to be handled properly.  In particular, the entire
    directive must be contained on a single line to be removed correctly;
    if not, the resulting file will have broken syntax.  module() direc-
    tives must also start at the first column to be recognized.
    faacbec2
    Make syslog::modload deal with RainerScript.
    Thomas Bellman authored
    Newer versions of rsyslog, a "scripting language" for configuring
    rsyslog, named RainerScript, has been introduced, with version 6
    the first version with full support.  RainerScript has a new way
    of loading (and configuring) modules: ``module(load="NAME" ...)''
    replaces the old $ModLoad directive.  The old syntax still works,
    and you can mix them (and there are some features as of yet only
    available using the old-style ``$'' directives).
    
    We want to be able to use the new-style declarations, so we need
    to adapt the syslog::modload definition to at least cope with the
    new syntax in existing files and not add $ModLoad directives if
    there is already a module() directive for the same module.  And
    also be able to delete module() directives for ensure=>absent.
    
    For the time being, we only change syslog::modload to recognize
    the new syntax when it exists in the file, and if we need to add
    a loading directive, the old syntax will be used, to support older
    versions of rsyslog.
    
    Our implementation is also quite limited in how module() directives
    may be formatted to be handled properly.  In particular, the entire
    directive must be contained on a single line to be removed correctly;
    if not, the resulting file will have broken syntax.  module() direc-
    tives must also start at the first column to be recognized.
Loading