Giter Club home page Giter Club logo

puppet-rsyslog's Introduction

puppet-rsyslog

Build Status License Puppet Forge Puppet Forge Puppet Forge Puppet Forge

Table of Contents

  1. Overview
  2. Module Description
  3. Setup
  4. Usage
  5. Known Issues
  6. License
  7. Maintainer

Overview

This module was first published as crayfishx/rsyslog. It has now moved to puppet/rsyslog and is managed by the community group Vox Pupuli.

Module Description

This module manages the rsyslog server and client configuration. It supports rsyslog v8 and defaults to configuring most things in the newer rainerscript configuration style. Where possible, common configuration patterns have been abstracted so they can be defined in a structured way from hiera. Though there are a lot of customization options with the configuration, highly complex rsyslog configurations are not easily represented in simple data structures and in these circumstances you may have to provide raw rainerscript code to acheive what you need. However, the aim of this module is to abstract as much as possible.

This module is only compatible with Puppet 4.0.0+

Setup

What this module affects

  • Installs the Rsyslog package, service, and configuration.
  • Install ancillary plugin packages.

Beginning with this module

This declaration will get you basic configuration for Rsyslog on your system:

include rsyslog::config

Usage

Rsyslog Configuration Directives

Config file

By default, everything is configured in a single file under $confdir called 50_rsyslog.conf. This means that packages and other OS specific configurations can also be included (see purge_config_files above). The default file can be changed using the rsyslog::target_file directive and is relative to the confdir.

eg:

rsyslog::target_file: 50_rsyslog.conf

You can, however, define custom confdirs and/or custom paths for configuration files. All configuration options have the following global options you can add to their hiera keys:

  • priority - Order in the file to place the config value relative to the other config options in the file. Takes an integer. Defaults to the priority set for the configuration type. See Ordering for more.
  • target - Target file to place the config values in. Defaults to 50_rsyslog.conf in the default $confdir.
  • confdir - Target configuration directory. Defaults to /etc/rsyslog.d.
Ordering

The following configuration parameters are defaults for the order of configuration object types within the configuration file. They can be overriden for individual object definitions (see configuring objects below)

## Default object type priorities (can be overridden)
rsyslog::global_config_priority: 10
rsyslog::module_load_priority: 20
rsyslog::input_priority: 30
rsyslog::main_queue_priority: 40
rsyslog::parser_priority: 45
rsyslog::template_priority: 50
rsyslog::filter_priority: 55
rsyslog::action_priority: 60
rsyslog::ruleset_priority: 65
rsyslog::lookup_table_priority: 70
rsyslog::legacy_config_priority: 80
rsyslog::custom_priority: 90

Ordering is done numerically. I.E. 111 is after 110 is after 99.

Configuring Objects

Configuration objects are written to the configuration file in rainerscript format and can be configured in a more abstract way directly from Hiera. The following configuration object types are supported

rsyslog::config::modules

A hash of hashes, hash key represents the module name and accepts a hash with values or an empty hash as its value. The hash accepts the following three values:

  • type: values can be external or builtin the default value is external and need not be specified explicitly.
  • config: its a hash which provides optional parameters to the module loaded.
  • priority: The module load order can be prioritised based on the optional priority value.

Puppet example:

class { 'rsyslog::config':
  'modules' => {
    'imuxsock' => {},
    'imudp' => {
      'config' => {
        'threads'     => '2',
        'TimeRequery' => '8',
        'batchSize'   => '128',
      },
    },
    'omusrmsg' => {
      'type' => 'builtin',
    },
    'omfile' => {
      'type'   => 'builtin',
      'config' => {
        'fileOwner'      => 'syslog',
        'fileGroup'      => 'adm',
        'dirGroup'       => 'adm',
        'fileCreateMode' => '0640',
        'dirCreateMode'  => '0755',
      },
    },
    'impstats' => {
      'type'     => 'external',
      'priority' => 29,
      'config'   => {
        'interval'   => '60',
        'severity'   => '7',
        'log.syslog' => 'off',
        'log.file'   => '/var/log/rsyslog/logs/stats/stats.log',
        'Ruleset'    => 'remote',
      },
    },
  },
}

Hiera example:

rsyslog::config::modules:
  imuxsock: {}
  imudp:
    config:
      threads: "2"
      TimeRequery: "8"
      batchSize: "128"
  omusrmsg:
    type: "builtin"
  omfile:
    type: "builtin"
    config:
      fileOwner: "syslog"
      fileGroup: "adm"
      dirGroup: "adm"
      fileCreateMode: "0640"
      dirCreateMode: "0755"
  impstats:
    type: "external"
    priority: 29
    config:
      interval: "60"
      severity: "7"
      log.syslog: "off"
      log.file: "/var/log/rsyslog/logs/stats/stats.log"
      Ruleset: "remote"

will produce

module (load="imuxsock")
module (load="imudp"
           threads="2"
           TimeRequery="8"
           batchSize="128"

)
module (load="builtin:omusrmsg")
module (load="builtin:omfile"
           fileOwner="syslog"
           fileGroup="adm"
           dirGroup="adm"
           fileCreateMode="0640"
           dirCreateMode="0755"

)
module (load="impstats"
           interval="60"
           severity="7"
           log.syslog="off"
           log.file="/var/log/rsyslog/logs/stats/stats.log"
           Ruleset="remote"

)
rsyslog::config::global_config

A hash of hashes, they key represents the configuration setting and the value is a hash with the following keys:

  • value: the value of the setting
  • type: the type of format to use (legacy or rainerscript), if omitted rainerscript is used.

Puppet example:

class { 'rsyslog::config':
  'global_config' => {
    'umask' => {
      'value'    => '0000',
      'type'     => 'legacy',
      'priority' => 01,
    },
    'RepeatedMsgReduction' => {
      'value' => 'on',
      'type'  => 'legacy',
    },
    'PrivDropToUser' => {
      'value' => 'syslog',
      'type'  => 'legacy',
    },
    'PrivDropToGroup' => {
      'value' => 'syslog',
      'type'  => 'legacy',
    },
    'parser.escapeControlCharactersOnReceive' => {
      'value' => 'on',
    },
    'workDirectory' => {
      'value' => '/var/spool/rsyslog',
    },
    'maxMessageSize' => {
      'value' => '64k',
    },
  },
}

Hiera example:

rsyslog::config::global_config:
  umask:
    value: '0000'
    type: legacy
    priority: 01
  RepeatedMsgReduction:
    value: 'on'
    type: legacy
  PrivDropToUser:
    value: 'syslog'
    type: legacy
  PrivDropToGroup:
    value: 'syslog'
    type: legacy
  parser.escapeControlCharactersOnReceive:
    value: 'on'
  workDirectory:
    value: '/var/spool/rsyslog'
  maxMessageSize:
    value: '64k'

will produce

$umask 0000
$PrivDropToGroup syslog
$PrivDropToUser syslog
$RepeatedMsgReduction on
global (
    parser.escapeControlCharactersOnReceive="on"
    workDirectory="/var/spool/rsyslog"
    maxMessageSize="64k"
)
rsyslog::config::main_queue_opts

Configures the main_queue object in rsyslog as a hash. eg:

Puppet Example:

class { 'rsyslog::config':
  'main_queue_opts' => {
    'queue.maxdiskspace'     => '1000G',
    'queue.dequeuebatchsize' => 1000,
  }
}

Hiera Example:

rsyslog::config::main_queue_opts:
  queue.maxdiskspace: 1000G
  queue.dequeuebatchsize: 1000

will produce

main_queue(
  queue.maxdiskspace="1000G"
  queue.dequeuebatchsize="1000"
)
rsyslog::config::templates

Configures template objects in rsyslog. Each element is a hash containing the name of the template, the type and the template data. The type parameter can be one of string, subtree, plugin or list

Puppet Example:

class { 'rsyslog::config':
  'templates' => {
    'remote' => {
      'type'   => 'string',
      'string' => '/var/log/rsyslog/logs/%fromhost-ip%.log',
    },
    'tpl2' => {
      'type'    => 'subtree',
      'subtree' => '$1!$usr',
    },
    'someplug' => {
      'type'   => 'plugin',
      'plugin' => 'foobar',
    },
  }
}

Hiera Example:

rsyslog::config::templates:
  remote:
    type: string
    string: "/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log"
  tpl2:
    type: subtree
    subtree: "$1!$usr"
  someplug:
     type: plugin
     plugin: foobar

will produce

template (name="remote" type="string"
  string="/var/log/rsyslog/logs/%fromhost-ip%/%fromhost-ip%.log"
)

When using list, the list_descriptions hash should contain an array of single element hashes, the key should be constant or property with their corresponding parameters in a sub hash.

Puppet example:

class { 'rsyslog::config':
  'templates' => {
    'plain-syslog' => {
      'type' => 'list',
      'list_descriptions' => [
        {
          'constant' => {
            'value' => '{',
          }
        },
        {
          'constant' => {
            'value' => '\"@timestamp\":\"',
          }
        },
        {
          'propery' => {
            'name' => 'timereported',
            'dateFormat' => 'rfc3339',
          }
        },
        {
          'constant' => {
            'value' => '\",\"host\":\"'
          }
        },
        {
          'property' => {
            'name' => 'hostname'
          }
        },
        {
          'constant' => {
            'value' => '\",\"severity\":\"'
          }
        },
        {
          'property' => {
            'name' => 'syslogseverity-text',
          }
        },
        {
          'constant' => {
            'value' => '\",\"facility\":\"'
          }
        },
        {
          'property' => {
            'name' => 'syslogfacility-text'
          }
        },
        {
          'constant' => {
            'value' => '\",\"host\":\"'
          }
        },
        {
          'property' => {
            'name'   => 'syslogtag',
            'format' => 'json',
          }
        },
        {
          'constant' => {
            'value' => '\",\"message\":\"'
          }
        },
        {
          'property' => {
            'name'   => 'msg',
            'format' => 'json'
          }
        },
        {
          'constant' => {
            'value' => '\"}'
          }
        }
      ]
    }
  }
}

Hiera example:

  plain-syslog:
    type: list
    list_descriptions:
      - constant:
          value: '{'
      - constant:
          value: '\"@timestamp\":\"'
      - property:
         name: timereported
         dateFormat: rfc3339
      - constant:
         value: '\",\"host\":\"'
      - property:
         name: hostname
      - constant:
         value: '\",\"severity\":\"'
      - property:
         name: syslogseverity-text
      - constant:
         value: '\",\"facility\":\"'
      - property:
         name: syslogfacility-text
      - constant:
         value: '\",\"tag\":\"'
      - property:
         name: syslogtag
         format: json
      - constant:
         value: '\",\"message\":\"'
      - property:
         name: msg
         format: json
      - constant:
         value: '\"}'

will produce

template (name="plain-syslog" type="list"
)
{
    constant(value="{" )
    constant(value="\"@timestamp\":\"" )
    property(name="timereported" dateFormat="rfc3339" )
    constant(value="\",\"host\":\"" )
    property(name="hostname" )
    constant(value="\",\"severity\":\"" )
    property(name="syslogseverity-text" )
    constant(value="\",\"facility\":\"" )
    property(name="syslogfacility-text" )
    constant(value="\",\"tag\":\"" )
    property(name="syslogtag" format="json" )
    constant(value="\",\"message\":\"" )
    property(name="msg" format="json" )
    constant(value="\"}" )
}

rsyslog::config::actions

Configures action objects in rainerscript. Each element of the hash contains the type of action, followed by a hash of configuration options. It also accepts an optional facility parameter and the content is formatted based on the no of config options passed and if the facility option is present.

Puppet example:

class { 'rsyslog::config':
  'actions' => {
    'all_logs' => {
      'type'     => 'omfile',
      'facility' => '*.*;auth,authpriv.none',
      'config'   => {
        'dynaFile'  => 'remoteSyslog',
        'specifics' => '/var/log/test',
      }
    },
    'kern_logs' => {
      'type'     => 'omfile',
      'facility' => 'kern.*',
      'config'   => {
        'dynaFile' => 'remoteSyslog',
        'file'     => '/var/log/kern.log',
        'cmd'      => '/proc/cmdline',
      }
    },
    'elasticsearch' => {
      'type'   => 'omelasticsearch',
      'config' => {
        'queue.type'           => 'linkedlist',
        'queue.spoolDirectory' => '/var/log/rsyslog/queue'
      }
    }
  }
}

Hiera example:

rsyslog::config::actions:
  all_logs:
    type: omfile
    facility: "*.*;auth,authpriv.none"
    config:
      dynaFile: "remoteSyslog"
      specifics: "/var/log/test"
  kern_logs:
    type: omfile
    facility: "kern.*"
    config:
      dynaFile: "remoteSyslog"
      file: "/var/log/kern.log"
      cmd: "/proc/cmdline"
  elasticsearch:
    type: omelasticsearch
    config:
      queue.type: "linkedlist"
      queue.spoolDirectory: /var/log/rsyslog/queue

will produce

#Note: There is only 2 options passed so formats in a single line.
# all_logs
*.*;auth,authpriv.none         action(type="omfile" dynaFile="remoteSyslog" specifics="/var/log/test" )

#Note: There is more than 2 options passed so formats into multi line with facility.
# kern_logs
kern.*                         action(type="omfile"
                                 dynaFile="remoteSyslog"
                                 file="/var/log/kern.log"
                                 cmd="/proc/cmdline"
                               )

#Note: There is no facility option passed so formats it without facility.
action(type="omelasticsearch"
  queue.type="linkedlist"
  queue.spoolDirectory="/var/log/rsyslog/queue"
)
rsyslog::config::inputs

Configures input objects in rainerscript. Each element of the hash contains the type of input, followed by a hash of configuration options. Eg:

Puppet examples:

class { 'rsyslog:config':
  'inputs' => {
    'imudp' => {
      'type'   => 'imudp',
      'config' => {
        'port' => '514'
      }
    }
  }
}

Hiera examples:

rsyslog::config::inputs:
  imudp:
    type: imudp
    config:
      port: '514'

will produce

# imdup
input(type="imudp"
  port="514"
)
rsyslog::config::lookup_tables

Configures lookup_tables objects in rainerscript AND generates the JSON lookup_table file. Each key of the hash contains the name of the lookup/lookup_table. The elements of the hash contain a json hash containing the values for the JSON file, a lookup_file element that is the path to where the JSON file will be stored, and a reload_on_hup boolean.

The json hash contains 4 elements: version, nolookup, type, and table. They MUST be specified in this order as per the lookup_tables documentation:

  • version - Integer denoting the version/revision of the lookup_table file.
  • nolookup - String denoting what should be returned if a lookup doesn't find a match in the table.
  • type - Enumerable denoting the type of lookup table. This can be string, array, or sparseArray.
  • table - An Array of hashes containing the table index and value for each lookup.

Puppet example:

class { 'rsyslog::config':
  'lookup_tables' => {
    'ip_lookup' => {
      'lookup_json' => {
        'version'  => 1,
        'nolookup' => 'unk',
        'type'     => 'string',
        'table'    => [
          {
            'index' => '1.1.1.1',
            'value' => 'AB'
          },
          {
            'index' => '2.2.2.2',
            'value' => 'CD'
          }
        ]
      },
      'lookup_file'   => '/etc/rsyslog.d/tables/ip_lookup.json',
      'reload_on_hup' => true
    }
  }
}

Hiera Example:

rsyslog::config::lookup_tables:
  ip_lookup:
    lookup_json:
      version: 1
      nolookup: 'unk'
      type: 'string'
      table:
        - index: '1.1.1.1'
          value: 'AB'
        - index: '2.2.2.2'
          value: 'CD'
    lookup_file: '/etc/rsyslog.d/tables/ip_lookup.json'
    reload_on_hup: true

will produce

# /etc/rsyslog.d/tables/ip_lookup.json
{
  "version": 1,
  "nomatch": "unk",
  "type": "string",
  "table": [
    {
      "index": "1.1.1.1",
      "value": "A"
    },
    {
      "index": "2.2.2.2",
      "value": "B"
    }
  ]
}

and

lookup_table(name="ip_lookup" file="/etc/rsyslog.d/tables/ip_lookup.json" reloadOnHUP="on")

NOTE: This does not create the actual lookup() call in the Rsyslog configuration file(s). Currently that is only supported via the rsyslog::config::custom_config hash as it requires setting rsyslog variables (I.E. - set $.iplook = lookup('ip_lookup', $hostname)).

rsyslog::config::parser

Configures parser objects in rainerscript. Each Element of the hash contains the type of parser, followed by a hash of configuration options. Eg:

Puppet Example:

class { 'rsyslog::config':
  'parser' => {
    'pmrfc3164_hostname_with_slashes' => {
      'type'   => 'pmrfc3164',
      'config' => {
        'permit.slashesinhostname' => 'on'
      }
    }
  }
}

Hiera Example:

rsyslog::config::parser:
  pmrfc3164_hostname_with_slashes:
    type: pmrfc3164
    config:
      permit.slashesinhostname: 'on'

will produce

parser(name="pmrfc3164_hostname_with_slashes"
       type="pmrfc3164"
       permit.slashesinhostname="on"
)
rsyslog::config::rulesets

Configures Rsyslog ruleset blocks in rainerscript. There are two elements in the rulesets hash:

  • parameters - settings to pass to the ruleset determining things such as which rsyslog parser to use or the ruleset's queue size.
  • rules - the actual content that goes inside the ruleset. Currently the following are supported:
    • action - rsyslog actions defined inside of the ruleset.
    • lookup - Sets a variable to the results of an rsyslog lookup.
    • set - Set an rsyslog variable or property. Property explicitly requires that the set name be a string beginning with $!, while a variable can be a plain string or a string starting with $..
      • NOTE: Setting the variable with a string that does NOT begin with $. is deprecated and will be removed in the next major release!
    • call - call a specific action.
    • exec - execute the following system command
    • expression_filter - Filter based on one or more expressions.
    • property_filter - Filter based on one or more RsyslogD properties.
  • stop - a Boolean to set if the ruleset ends with a stop or not.

NOTE: For any rule key that can also be a standalone rsyslog resource (action, expression_filter, or property_filter), the user MUST define a name key that will be passed as the resource name to the template. This will be simplified in a future release.

NOTE: While it is entirely possible to configure Rulesets using the Puppet DSL, it is recommended against as Rulesets can easily become difficult to read when compared to the YAML-based hieradata.

Puppet example:

class { 'rsyslog::config':
  'rulesets' => {
    'ruleset_eth0_514_tcp' => {
      'parameters' => {
        'parser'     => 'pmrfc3164.hostname_with_slashes',
        'queue.size' => '10000',
      },
      'rules' => [
        { 'set' => { '$!rcv_time'  => 'exec_template("s_rcv_time")' }},
        { 'set' => { '$.utime_gen' => 'exec_template("s_unixtime_generated")' }},
        { 'set' => { 'uuid'        => '$uuid' }},
        {
          'action' => {
            'name' => 'utf8-fix',
            'type' => 'mmutf8fix',
          }
        },
        {
          'action' => {
            'name'     => 'test-action',
            'type'     => 'omfile',
            'facility' => '*.*;auth,authpriv.none',
            'config'   => {
              'dynaFile'  => 'remoteSyslog',
              'specifics' => '/var/log/test'
            }
          }
        },
        {
          'action' => {
            'name'   => 'test-action2',
            'type'   => 'omfile',
            'config' => {
              'dynaFile'  => 'remoteSyslog',
              'specifics' => '/var/log/test'
            }
          }
        },
        {
          'lookup' => {
            'var'          => 'srv',
            'lookup_table' => 'srv-map',
            'expr'         => '$fromhost-ip'
          }
        },
        { 'call' => 'action.parse.rawmsg' },
        { 'call' => 'action.parse.r_msg' },
      ],
      'stop' => true,
    }
  }
}

Hiera example:

rsyslog::config::rulesets:
  ruleset_eth0_514_tcp:
    parameters:
      parser: pmrfc3164.hostname_with_slashes
      queue.size: '10000'
    rules:
      - set:
          # Set a Property with a value from a template.
          $!rcv_time: 'exec_template("s_rcv_time")'
      - set:
          # Set a Variable with a value from a template.
          $.utime_gen: 'exec_template("s_unixtime_generated")'
      - set:
          # Set a Variable using the deprecated method with a value from $uuid
          uuid: '$uuid'
      - action:
          name: utf8-fix
          type: mmutf8fix
      - action:
          name: test-action
          type: omfile
          facility: "*.*;auth,authpriv.none"
          config:
            dynaFile: "remoteSyslog"
            specifics: "/var/log/test"
      - action:
          name: test-action2
          type: omfile
          config:
            dynaFile: "remoteSyslog"
            specifics: "/var/log/test"
      - lookup:
          var: srv
          lookup_table: srv-map
          expr: '$fromhost-ip'
      - call: 'action.parse.rawmsg'
      - call: 'action.parse.r_msg'
      - exec: '/bin/echo'
    stop: true

Will produce:

ruleset (name="ruleset_eth0_514_tcp"
  parser="pmrfc3164.hostname_with_slashes"
  queue.size="10000"
) {
  set $.rcv_time = exec_template("s_rcv_time");
  set $.utime_gen = exec_template("s_unixtime_generated");
  set $.uuid = $uuid;
  # utf8-fix action
  action(type="mmutf8fix"
    name="utf8-fix"
  )
  # test-action action
*.*;auth,authpriv.none         action(type="omfile"
                                 name="test-action"
                                 dynaFile="remoteSyslog"
                                 specifics="/var/log/test"
                               )
  # test-action2 action
  action(type="omfile"
    name="test-action2"
    dynaFile="remoteSyslog"
    specifics="/var/log/test"
  )
  set $.srv = lookup("srv-map", $fromhost-ip);
  call action.parse.rawmsg
  call action.parse.r_msg
  ^/bin/echo
  stop
}

Rulesets can also contain filtering logic for calling other rulesets, setting other variables, or even dropping logs based on specific values. Filtering logic is required to utilize lookup_tables and lookup calls.

Rsyslog puppet supports two kinds of filters:

  • expression_filter
  • property_filter

More information about Rsyslog Filters can be found at: http://www.rsyslog.com/doc/v8-stable/configuration/filters.html

Ruleset Expression Filter

Expression filters use traditional if/else and if/else if/else logic to execute rules on specific return values. lookup_tables are compatible ONLY with expression_filters

The Ruleset expression_filter key has a few different keys than the rsyslog::config::expression_filters parameter:

  • name - Currently required to prevent errors. This is logical and only used by Puppet.
  • filter - The filter key is synonymous with the conditionals key found in the rsyslog::config::expression_filters parameter. See the Expression Filter Docs for more info.

Puppet Example:

class { 'rsyslog::config':
  'rulesets' => {
    'ruleset_eth0_514_udp' => {
      'parameters' => {
        'queue.type' => 'LinkedList'
      },
      'rules' => [
        {
          'expression_filter' => {
            'filter' => {
              'if' => {
                'expression' => '$fromhost-ip == "192.168.255.1"',
                'tasks' => [
                  { 'call' => 'ruleset.action.rawlog.standard' },
                  { 'stop' => true }
                ]
              }
            }
          }
        },
        { 'call' => 'ruleset.client.log.standard' },
        { 'call' => 'ruleset.unknown.standard' },
      ],
      'stop' => true
    }
  }
}

Hiera Example:

rsyslog::config::rulesets:
  ruleset_eth0_514_udp:
    parameters:
      queue.type: LinkedList
    rules:
      - expression_filter:
          filter:
            if:
              expression: '$fromhost-ip == "192.168.255.1"'
              tasks:
                - call: "ruleset.action.rawlog.standard"
                - stop: true
      - call: "ruleset.client.log.standard"
      - call: "ruleset.unknown.standard"
    stop: true

will produce:

ruleset (name="ruleset_eth0_514_tcp"
  queue.type="LinkedList"
) {
  if $fromhost-ip == "192.168.255.1" then {
    call ruleset.action.rawlog.standard
    stop
  }
  call ruleset.client.log.standard
  call ruleset.unknown.standard
  stop
}

Puppet example with lookup tables: NOTE: Good example for how to define multiple rsyslog resources in a single rsyslog::config class

class { 'rsyslog::config':
  'lookup_tables' => {
    'srv-map' => {
      'lookup_json'   => {
        'version'  => 1,
        'nolookup' => 'unk',
        'type'     => 'string',
        'table'    => [
          {
            'index' => '192.168.255.10',
            'value' => 'windows'
          },
          {
            'index' => '192.168.255.11',
            'value' => 'windows'
          },
          {
            'index' => '192.168.255.12',
            'value' => 'linux'
          }
        ],
      },
      'lookup_file'   => '/etc/rsyslog.d/tables/srv-map.json',
      'reload_on_hup' => true
    }
  },
  'rulesets' => {
    'ruleset_lookup_set_windows_by_ip' => {
      'rules' => [
        {
          'lookup' => {
            'var'          => 'srv',
            'lookup_table' => 'srv-map',
            'expr'         => '$fromhost-ip'
          }
        },
        {
          'expression_filter' => {
            'filter' => {
              'main' => {
                'expression' => '$.srv == \"windows\"',
                'tasks' => [
                  { 'call' => 'ruleset.action.forward.windows' },
                  { 'stop' => true }
                ]
              },
              'unknown_log' => {
                'expression' => '$.srv == \"unk\"',
                'tasks' => [
                  { 'call' => 'ruleset.action.drop.unknown' },
                  { 'stop' => 'true' }
                ]
              },
              'default' => {
                'tasks' => [
                  { 'stop' => 'true' }
                ]
              }
            }
          }
        }
      ]
    }
  }
}

Example with lookup:

rsyslog::config::lookup_tables:
  srv-map:
    lookup_json:
      version: 1
      nolookup: 'unk'
      type: 'string'
      table:
        - index: '192.168.255.10'
          value: 'windows'
        - index: '192.168.255.11'
          value: 'windows'
        - index: '192.168.255.12'
          value: 'linux'
    lookup_file: '/etc/rsyslog.d/tables/srv-map.json'
    reload_on_hup: true
rsyslog::config::rulesets:
  ruleset_lookup_set_windows_by_ip:
    rules:
      - lookup:
          var: srv
          lookup_table: srv-map
          expr: '$fromhost-ip'
      - expression_filter:
          filter:
            main:
              expression: '$.srv == "windows"'
              tasks:
                - call: "ruleset.action.forward.windows"
                - stop: true
            unknown_log:
              expression: '$.srv == "unk"'
              tasks:
                - call: "ruleset.action.drop.unknown"
                - stop: true
            default:
              tasks:
                - stop: true
    stop: true

Will produce:

#/etc/rsyslog.d/tables/srv-map.json
{
  "version": 1,
  "nomatch": "unk",
  "type": "string",
  "table": [
    {
      "index": "192.168.255.10",
      "value": "windows"
    },
    {
      "index": "192.168.255.11",
      "value": "windows"
    },
    {
      "index": "192.168.255.12",
      "value": "linux"
    }
  ]
}
#rsyslog.conf
lookup_table(name="srv-map" file="/etc/rsyslog.d/tables/srv-map.json" reloadOnHUP=on)

ruleset(name="ruleset_lookup_set_windows_by_ip"
) {
  set $.srv = lookup("srv-map", $fromhost-ip);
  if ($.srv == "windows") then {
    call ruleset.action.forward.windows
    stop
  } else if ($.srv == "unk") then {
    call ruleset.action.drop.unknown
    stop
  } else {
    stop
  }
}
Ruleset Property Filters

property_filters are unique to rsyslogd. They allow to filter on any property, like HOSTNAME, syslogtag and msg. property_filters are faster than expression_filters as they us built-in rsyslog properties to lookup and match data.

Puppet Example:

class { 'rsyslog::config':
  'rulesets' => {
    'ruleset_msg_check_for_error' => {
      'rules' => [
        {
          'property_filter' => {
            'property' => 'msg',
            'operator' => 'contains',
            'value'    => 'error',
            'tasks'    => [
              { 'call' => 'ruleset.action.error' },
              { 'stop' => true }
            ]
          }
        }
      ]
    }
  }
}

Hiera Example:

rsyslog::config::rulesets:
  ruleset_msg_check_for_error:
    rules:
      - property_filter:
          property: 'msg'
          operator: 'contains'
          value: 'error'
          tasks:
            - call: 'ruleset.action.error'
            - stop: true

Will Generate:

#rsyslog.conf
ruleset(name="ruleset_msg_check_for_error"
) {
  :msg, contains, "informational" {
    call ruleset.action.error
    stop
  }
}
rsyslog::config::property_filters

Rsyslog has the ability to filter each log line based on log properties and/or variables.

There are four kinds of filters in Rsyslog:

  • "traditional" severity/facility based Selectors - handled in the Actions parameter.
  • BSD-style blocks - not supported in Rsyslog 7+ and as such are not supported in this module.
  • Property-based Filters
  • Expression-based Filters

This section covers Property and Expression based filters.

Property-based Filters

Property-based filters are unique to rsyslogd. They allow to filter on any property, like HOSTNAME, syslogtag and msg. Property-based filters are only supported with native properties in Rsyslog. See Rsyslog Properties for a list of supported properties.

The rsyslog::config::property_filters parameter is a Hash of hashes where the hash-key is the logical name for the filter. This name is for Puppet resource naming purposes only and has no other function. The filter name has several additional child keys as well:

  • property - the Rsyslogd property the filter will lookup.
  • operator - the Rsyslogd property filter-supported operator to compare the property value with the expected value. See Rsyslog Property Compare-Operations for a list of supported operators. These operators are validated with the Rsyslog::PropertyOperator data type.
  • value - the value that the property filter will match against.
  • tasks - A hash of actions to take in the event of a filter match.
    • All sub-keys for the tasks hash maps to another rsyslog configuration object.

Puppet Example:

class { 'rsyslog::config':
  'property_filters' => {
    'hostname_filter' => {
      'property' => 'hostname',
      'operator' => 'contains',
      'value'    => 'some_hostname',
      'tasks'    => [
        {
          'action' => {
            'name'     => 'omfile_defaults',
            'type'     => 'omfile',
            'facility' => '*.*;auth,authpriv.none',
            'config'   => {
              'dynaFile'  => 'remoteSyslog',
              'specifics' => '/var/log/test',
            }
          }
        },
        { 'stop' => true }
      ]
    },
    'ip_filter' => {
      'property' => 'fromhost-ip',
      'operator' => 'startswith',
      'value'    => '192',
      'tasks'    => [
        { 'stop' => true }
      ]
    }
  }
}

Hiera Example:

rsyslog::config::property_filters:
  hostname_filter:
    property: hostname
    operator: contains
    value: some_hostname
    tasks:
      - action:
          name: omfile_defaults
          type: omfile
          facility: "*.*;auth,authpriv.none"
          config:
            dynaFile: "remoteSyslog"
            specifics: "/var/log/test"
      - stop: true
  ip_filter:
    property: fromhost-ip
    operator: startswith
    value: '192'
    tasks:
      - stop: true

will produce

:hostname, contains, "some_hostname" {
  *.*;auth,authpriv.none        action(type="omfile" dynaFile="remoteSyslog" specifics="/var/log/test")
  stop
}

:fromhost-ip, startswith, "192" {
  stop
}
Expression-based Filters

Expression-based filters allow filtering on arbitrary complex expressions, which can include boolean, arithmetic and string operations.

Expression-based filters are also what are used to match against lookup_table data.

The rsyslog::config::expression_filters parameter is a Hash of hashes where the hash-key is the logical name for the filter. This name is for Puppet resource naming purposes only and has no other function. The filter name has a few additional child keys as well:

  • conditionals - Hash describing the different conditional cases, which are hashes of hashes.
    • cases - Hash of hashes. This has two reserved keys and four reserved names:
      • if/main - This is the primary condition for your expression. if is provided for backwards compatibility. required
      • else/default - This defines the optional "default" or "fall through" condition. else is provided for backwards compatibility.
      • [string] case - All other cases are defined by your own descriptive name. These names are non-functional and purely for organizational purposes. They will render as an else if in the rsyslog configuration.
    • expression - The string "expression" that will be used to match values. With all the potential options for logic, this was the easiest way to provide everyone with what they may need.
    • tasks - A hash of actions to take in the event of a filter match.
      • All sub-keys for the tasks hash maps to another rsyslog configuration object.
Puppet Examples

Old Syntax (still works):

class { 'rsyslog::config':
  'expression_filters' => {
    'hostname_filter' => {
      'conditionals' => {
        'if' => {
          'expression' => '$msg contains "error"',
          'tasks'      => [
            {
              'action' => {
                'name'   => 'omfile_error',
                'type'   => 'omfile',
                'config' => { 'specifics' => '/var/log/errlog' }
              }
            }
          ]
        }
      }
    }
  }
}

New Syntax:

class { 'rsyslog::config':
  'expression_filters' => {
    'hostname_filter' => {
      'conditionals' => {
        'main' => {
          'expression' => '$msg contains "error"',
          'tasks'      => [
            {
              'action' => {
                'name'   => 'omfile_error',
                'type'   => 'omfile',
                'config' => { 'specifics' => '/var/log/errlog' }
              }
            }
          ]
        }
      }
    }
  }
}
Hiera Examples

Old syntax (still works):

rsyslog::config::expression_filters:
  hostname_filter:
    conditionals:
      # Uses the "if" keyword
      if:
        expression: '$msg contains "error"'
        tasks:
          - action:
              name: omfile_error
              type: omfile
              config:
                specifics: /var/log/errlog

New syntax:

rsyslog::config::expression_filters:
  hostname_filter:
    conditionals:
      # Uses the "main" keyword
      main:
        expression: '$msg contains "error"'
        tasks:
          - action:
              name: omfile_error
              type: omfile
              config:
                specifics: /var/log/errlog

both will produce:

if $msg contains "error" then {
  action(type="omfile" specifics="/var/log/errlog")
}

NOTE: Due to the amount of potential options available to the user, the expression key is a plain text string field and the expression logic must be written out. See next example for more details.

Puppet Examples

Old Syntax (still works):

class { 'rsyslog::config':
  'expression_filters' => {
    'complex_filter' => {
      'conditionals' => {
        'if' => {
          'expression' => '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")',
          'tasks'      => [
            { 'stop' => true }
          ]
        },
        'else' => {
          'tasks' => [
            'action' => {
              'name'   => 'error_log',
              'type'   => 'omfile',
              'config' => { 'specifics' => '/var/log/errlog' }
            }
          ]
        }
      }
    }
  }
}

New Syntax:

class { 'rsyslog::config':
  'expression_filters' => {
    'complex_filter' => {
      'conditionals' => {
        'main' => {
          'expression' => '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")',
          'tasks'      => [
            { 'stop' => true }
          ]
        },
        'default' => {
          'tasks' => [
            'action' => {
              'name'   => 'error_log',
              'type'   => 'omfile',
              'config' => { 'specifics' => '/var/log/errlog' }
            }
          ]
        }
      }
    }
  }
}
Hiera Examples

Old Syntax (still works):

rsyslog::config::expression_filters:
  complex_filter:
    conditionals:
      # Uses the "if" keyword
      if:
        expression: '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")'
        tasks:
          - stop: true
      # Uses the "else" keyword
      else:
        tasks:
          - action:
              name: error_log
              type: omfile
              config:
                specifics: /var/log/errlog

New Syntax:

rsyslog::config::expression_filters:
  complex_filter:
    conditionals:
      # Uses the "main" keyword
      main:
        expression: '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")'
        tasks:
          - stop: true
      # Uses the "default" keyword
      default:
        tasks:
          - action:
              name: error_log
              type: omfile
              config:
                specifics: /var/log/errlog

both will produce:

if $syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0") then {
  stop
}
else {
  action(type="omfile" specifics="/var/log/errlog")
}

Example using more than two conditions:

Puppet Examples

class { 'rsyslog::config':
  'expression_filters' => {
    'conditionals' => {
      'main' => {
        'expression' => '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")',
        'tasks'      => [{ 'stop' => true }]
      },
      'errlog' => {
        'expression' => '$msg contains "error"',
        'tasks'      => [
          {
            'action' => {
              'name'   => 'omfile_error',
              'type'   => 'omfile',
              'config' => { 'specifics' => '/var/log/errlog' }
            }
          }
        ]
      },
      'default' => {
        'tasks' => [
          {
            'action' => {
              'name'   => 'system_log',
              'type'   => 'omfile',
              'config' => { 'specifics' => '/var/log/system' }
            }
          }
        ]
      }
    }
  }
}

Hiera Examples

rsyslog::config::expression_filters:
  complex_filter:
    conditionals:
      # Uses the "main" keyword
      main:
        expression: '$syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0")'
        tasks:
          - stop: true
      # Uses a descriptive keyname
      errlog:
        expression: '$msg contains "error"'
        tasks:
          - action:
              name: omfile_error
              type: omfile
              config:
                - specifics: /var/log/errlog
      # Uses the "default" keyword
      default:
        tasks:
          - action:
              name: system_log
              type: omfile
              config:
                specifics: /var/log/system

will produce:

if $syslogfacility-text == "local0" and $msg startswith "DEVNAME" and ($msg contains "error1" or $msg contains "error0") then {
  stop
} else if $msg == "error" then {
  action(type="omfile" specifics="/var/log/errlog")
} else {
  action(type="omfile" specifics="/var/log/system")
}
rsyslog::config::legacy_config

Legacy config support is provided to facilitate backwards compatibility with sysklogd format as this module mainly supports rainerscript format.

A hash of hashes, each hash name is used as the comment/reference for the setting and the hash will have the following values:

  • key: the key/logger rule setting
  • value: the value/target of the setting
  • type: the type of format to use (legacy or sysklogd), if omitted sysklogd is used. If legacy type is used key can be skipped and one long string can be provided as value.
Puppet Examples
class { 'rsyslog::config':
  'legacy_config' => {
    'auth_priv_rule' => {
      'key'   => 'auth,authpriv.*',
      'value' => '/var/log/auth.log',
    },
    'auth_none_rule' => {
      'key'   => '*.*;auth,authpriv.none',
      'value' => '/var/log/syslog',
    },
    'syslog_all_rule' => {
      'key'   => 'syslog.*',
      'value' => '/var/log/rsyslog.log',
    },
    'mail_error_rule' => {
      'key'   => 'mail.err',
      'value' => '/var/log/mail.err',
    },
    'news_critical_rule' => {
      'key'   => 'news.crit',
      'value' => '/var/log/news/news.crit',
    }
  }
}
Hiera Examples
rsyslog::config::legacy_config:
  auth_priv_rule:
    key: "auth,authpriv.*"
    value: "/var/log/auth.log"
  auth_none_rule:
    key: "*.*;auth,authpriv.none"
    value: "/var/log/syslog"
  syslog_all_rule:
    key: "syslog.*"
    value: "/var/log/rsyslog.log"
  mail_error_rule:
    key: "mail.err"
    value: "/var/log/mail.err"
  news_critical_rule:
    key: "news.crit"
    value: "/var/log/news/news.crit"

will produce

# auth_priv_rule
auth,authpriv.*    /var/log/auth.log

# auth_none_rule
*.*;auth,authpriv.none    /var/log/syslog

# syslog_all_rule
syslog.*    /var/log/rsyslog.log

# mail_error_rule
mail.err    /var/log/mail.err

# news_critical_rule
news.crit    /var/log/news/news.crit

legacy type values can be passed as one long string skipping the key parameter like below and you can also override the priority in the hash to rearrange the contents eg:

  emergency_rule:
    key: "*.emerg"
    value: ":omusrmsg:*"
  testing_legacy_remotelog:
    value: "*.* @@logmonster.cloudfront.net:1514"
    type: "legacy"
    priority: 12
  testing_legacy_rule:
    value: "*.* >dbhost,dbname,dbuser,dbpassword;dbtemplate"
    type: "legacy"

will produce

# emergency_rule
*.emerg    :omusrmsg:*

# testing_legacy_rule
*.* >dbhost,dbname,dbuser,dbpassword;dbtemplate

# testing_legacy_remotelog
*.* @@logmonster.cloudfront.net:1514

Positioning

All rsyslog object types are positioned according to the default variables (see Ordering). The position can be overridden for any object by adding the optional priority parameter.

eg:

rsyslog::config::actions:
  elasticsearch:
    type: omelasticsearch
    config:
      queue.type: "linkedlist"
      queue.spoolDirectory: "/var/log/rsyslog/queue"
    priority: 35

Formatting

This module attempts to abstract rainerscript objects into data structures that can be handled easily within hiera, however there are clearly times when you need to add some more code structure around an object, such as conditionals. For simple code additions, the template, action, input and global_config object types support the optional parameter of format which takes Puppet EPP formatted template as a value, using the variable $content to signify the object itself. For example, to wrap an action in a simple conditional you could format it as

eg:

rsyslog::config::actions:
  elasticsearch:
    type: omelasticsearch
    config:
      queue.type: "linkedlist"
      queue.spoolDirectory: "/var/log/rsyslog/queue"
    format: |
      if [ $fromhost == "foo.localdomain"] then {
      <%= $content %>
      }

For more complicated code structures that don't lend themselves well to a structured format, like multiple nested conditionals there is also a special configuration object type called custom_config. custom_config takes two arguments, priority to determine where in the file it should be configured, and content a text string to insert. By default the priority is set by the custom_config_priority parameter (see Ordering)

rsyslog::config::custom_config:
  localhost_action:
    priority: 45
    content: |
      if $fromhost == ["foo.localdomain","localhost"] then {
        action(type="omfile" file="/var/log/syslog")
      } else {
       action(type="omelasticsearch"
         queue.type="linkedlist"
         queue.spoolDirectory="/var/log/rsyslog/queue"
       )
    }

  stop:
    content: |
      if [ $fromhost == "foo" ] then stop

Known Issues

  • Designed specifically for Rsyslog 8+ and the Rainerscript configuration format. Legacy configuration/Rsyslog < 8 support requires the use of the custom_config parameter.
  • The upstream repository for EL8 is currently broken and will not work.

License

  • This module is licensed under Apache 2.0, see LICENSE for more details

Maintainer

  • This module is maintained by Vox Pupuli. It was originally written by Craig Dunn ([email protected]) @crayfishx.

puppet-rsyslog's People

Contributors

alexjfisher avatar amateo avatar arjenz avatar bastelfreak avatar bschonec avatar crayfishx avatar cruelsmith avatar dhollinger avatar dhoppe avatar ekohl avatar eputnam avatar evgeni avatar fatmcgav avatar ghoneycutt avatar hdep avatar jhoblitt avatar juniorsysadmin avatar kajinamit avatar kenyon avatar llowder avatar lmontand avatar maxadamo avatar olegps avatar paramite avatar root-expert avatar smortex avatar tragiccode avatar tuxmea avatar waipeng avatar zilchms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-rsyslog's Issues

puppet-rsyslog won't install on Puppet Open Source 6

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet:
    puppet6-release-6.0.0-5.el7.noarch
    puppetserver-6.5.0-1.el7.noarch
    puppet-agent-6.8.1-1.el7.x86_64

  • Ruby:
    default included in Puppet 6

  • Distribution:
    CentOS Linux release 7.6.1810 (Core)

  • Module version:
    3.3.0

How to reproduce (e.g Puppet code you use)

puppet module install puppet-rsyslog --version 3.3.0

What are you seeing

module fails to install due to dependency problem

What behaviour did you expect instead

successful installation

Output log

[root@host ~]# puppet module install puppet-rsyslog --version 3.3.0
Notice: Preparing to install into /etc/puppetlabs/code/environments/production/modules ...
Notice: Downloading from https://forgeapi.puppet.com ...
Error: Could not install module 'puppet-rsyslog' (???)
No version of 'puppet-rsyslog' can satisfy all dependencies
Use puppet module install --ignore-dependencies to install only this module
[root@host ~]#

Any additional information you'd like to impart

We have a clean Puppet 6 installation (no upgrades from earlier installs)
Here is the dependency list:
puppetlabs-stdlib (>= 1.0.0 < 6.0.0)
puppetlabs-concat (>= 2.0.0 < 6.0.0)
puppetlabs-apt (>= 5.0.0 < 7.0.0)

stdlib must be less than 6.0.0 for this module to install. This will break on clean installations of Puppet 6. Don't know about the other dependencies....

Client server split imposes unnecessary restrictions

We recently switched over to this module from saz/rsyslog (while it was marked as deprecated) and ran into an issue.

To avoid confusion - i will call physical servers "machines" so we can use "client" and "server" only to refer to the module usage.

Our use case is that we have multiple data centers, and in each one we have a couple of machines that (among other things) collect all the logs from all the other machines in the data center (including each other). So in any data center, all our machines are clients. But two machines are also servers.

Since every machine in our infrastructure is a client, I started out using rsyslog::client at a level of the hierarchy which covers all machines (as we did with saz/rsyslog). My syslog collection server is in its own module, so I can tag those servers as needing that module and get them writing logs to file.

I mistakenly thought I would be able to use rsyslog::server to configure the two machines per datacenter. Nope. Duplicate declaration: Class[Rsyslog::Config] is already declared in file ...

So then I tried to hack it by passing my rulesets etc. to the client class ... which you cant #58
So then I tried to look for an equivalent of saz/rsyslog::snippet ... also no joy. #109

So that leaves me with the options of:

  • Use rsyslog::server for all clients (confusing)
  • Write a server module that drops some files into /etc/rsyslod.d/ (poor cohesiveness)

The crux of it:
The design choice of forcing separation of clients and servers (which for a lot of people is convenient) ends up imposing a restriction on the user that the underlying rsyslog software does not.

The best solution would be one where I can configure rsyslog using hiera, or in a module, without restriction. The server/client split could be dropped completely in that scenario, as I could define that myself.

In lieu of that, implementing #109 would help tremendously in the short term. This functionality is tremendously powerful and useful.

Thanks for your time! I hope this feedback is useful in further improving this module.

👍 on the documentation BTW :)

configuration for mysql

A configuration question:
Are there examples of hiera configuration to push all incoming logs to mysql database Loganalyzer consumption?

Thank you

Support Filters

For lookup tables to be useful, rulesets and global config needs to support if/else statements.

rsyslog::snippet?

This is more of a feature request. saz/rsyslog has been deprecated, and he's pointing at this module as a replacement. One piece of saz/rsyslog that I was quite fond of was 'rsyslog::snippet', which was a simple way to create an rsyslog.d file without any further configuration, e.g.:

$log = '/var/log'
rsyslog::snippet { '00-puppet':
  content => "if \$programname == 'puppet-agent' then -${log}\n& stop"
}

It looks like rsyslog::component::custom_config is close, but you have to set more variables there than I want to get into. Would you be interested in implementing a more-basic rsyslog::snippet again?

https://forge.puppet.com/saz/rsyslog

Document ordering / sort algorithm

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.3
  • Ruby: 2.4
  • Distribution: ?
  • Module version:

How to reproduce (e.g Puppet code you use)

mail:
    priority: 110
    type: 'omfile'
    facility: 'mail.*'
    config:
      file: '/var/log/maillog'
  cron:
    priority: 111
    type: 'omfile'
    facility: 'cron.*'
    config:
      file: '/var/log/cron.log'

What are you seeing

These rules are places in the rsyslog file after global definitions (priority 10) but before templates, config, etc (20, 30...) To get it to sort properly I have had to use the following:

mail:
    priority: 6510
  cron:
    priority: 6511

What behaviour did you expect instead

Priority is shown in the examples as an integer. One assumes it would be sorted like an integer. I actually kindof like the effect of being able to just make longer numbers to sort within the section-- but the documentation makes no mention of this!

How do we configure this module for someone new to puppet

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: Puppet 5.5
  • Ruby:
  • Distribution: RedHat Eterprise Linux 6,7
  • Module version:

How to reproduce (e.g Puppet code you use)

What are you seeing

What behaviour did you expect instead

Output log

Any additional information you'd like to impart

imfile to send apache logs to remote syslog not working

Trying to configure rsyslog to forward to remote syslog, apache logs from file
rsyslog doc from https://www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html

but it seems most of imfile options are not recognized and no example is provided in forge readme

Only imfile reference that I found in puppet module is in acceptance test
https://github.com/voxpupuli/puppet-rsyslog/blob/4896d5d5a333c96327a14d3fcb33239edc4fb32e/spec/acceptance/inputs_spec.rb
so not sure what is filtering out other options

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.1
  • Ruby: 2.4.1
  • Distribution: Ubuntu 18.04 (rsyslogd 8.32)
  • Module version: 3.2.0

How to reproduce (e.g Puppet code you use)

  class { 'rsyslog::server':
    global_config   => {
        'umask' => {
            'value' => '0022',
            'type' => legacy,
            'priority' => 01, 
        },  
        'PrivDropToUser' => {
            'value' => 'syslog',
            'type' => legacy,
        },  
        'PrivDropToGroup' => {
            'value' => 'syslog',
            'type' => legacy,
        },  
        'workDirectory' => {
            'value' => '/var/spool/rsyslog',
        },  
        'maxMessageSize' => {
            'value' => '64k',
        }   
    },  
   inputs => {
        imfile => {
            type        => "imfile",
            config      => {
              File => "${apache_logdir}/access*log",
#              Tag  => 'apache-access:',
#              StateFile => 'stat-apache-access',
#              Severity => 'info',
#              PersistStateInterval => 20000,
#              Ruleset   => "remoteapachelog",
            }
        }
    },
    rulesets    => {
        remoteapachelog => {
            parameters => {
                'queue.filename' => 'QueueApache',
                'queue.type' => 'LinkedList',
                'queue.spoolDirectory' => "/var/log/rsyslog/queue",
                'queue.size' => 10000,
                'queue.maxdiskspace' => '1000G',
                'queue.timeoutqueue' => 3,
                'queue.dequeuebatchsize' => 1000,
                'queue.saveonshutdown' => 'on',
                'queue.timeoutenqueue' => 0,
                'action.resumeRetryCount' => -1,
            },
            rules      => [
                action => {
                    name    => 'testApache',
                    facility => "*.*",
                    config => {
                        type    => 'omfwd',
                        target  => 'remotelogserver2.local',
                        port    => 514,
                        protocol => 'tcp',
                    },
                }
            ],
        }
    }
  }

What are you seeing

       Error: Evaluation Error: Resource type not found: Ruleset (file: /tmp/kitchen/manifests/site.pp, line: 243, column: 15) on node d3ef8b5697ea

What behaviour did you expect instead

normal successful execution

Rename legacy_config defined type and class

What this module refers to as "legacy_config" is actually what Rsyslog refers to as the basic syslog configuration.

Vote for renaming this to match the rsyslog documentation.

example of what Rsyslog calls "Basic" syslog configuration:

mail.info /var/log/mail.log
mail.err @@server.example.net

How we create those in this module today:

rsyslog::component::legacy_config { 'mail.info':
  'priority'  => $rsyslog::legacy_config_priority,
  'target'    => $rsyslog::target_file,
  'confdir'  => $rsyslog::confdir,
  'key'       => 'mail.info',
  'value'    => '/var/log/mail.log',
}

rsyslog::component::legacy_config { 'mail.err':
  'priority'  => $rsyslog::legacy_config_priority,
  'target'    => $rsyslog::target_file,
  'confdir'  => $rsyslog::confdir,
  'key'       => 'mail.err',
  'value'    => '@@server.example.net',
}

rsyslog::base does not restart service

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.19
  • Ruby: 2.4.9
  • Distribution: CentOS 7
  • Module version: 5.0.0

How to reproduce (e.g Puppet code you use)

populate the rsyslog::feature_packages variable after managing rsyslog service with this module

What are you seeing

When I populate the rsyslog::feature_packages variable, it does not restart the (managed) rsyslog service. Looking at rsyslog::base, there is a lot of conditional logic that makes that challenging to ensure.

What behaviour did you expect instead

If I am installing packages, its likely that I want that change to restart the service. Suggest a refactor of rsyslog::base into rsyslog::install and rsyslog::service so that one class can notify the other from init.pp. EG https://github.com/puppetlabs/puppetlabs-ntp/tree/master/manifests

Output log

Any additional information you'd like to impart

I am willing to do a PR.

/etc/rsyslog.d/50_rsyslog.conf doesn't have a puppet header

Hello,

I played a bit with your module.
I just notice that the file generated by the module : /etc/rsyslog.d/50_rsyslog.conf does have a header like :

# FILE Managed by puppet

I think this would be great to have this information.

What do you think ?

Refactor Rulesets and Filters

Nearly every setting available inside of a ruleset is also available at the parent config level.

Rulesets should be refactored to enable the support of the following configuration options at the parent/top level base config:

  • Filters
  • Calls
  • Sets
  • Stops

Additionally, Rulesets and Filters should reuse code/templates for existing configuration options rather than duplicate code in the templates/manifests. This should make the templates and code more readable and potentially provide a path for validating data passed to the module.

Add '^' (execute program) rsyslog feature to ruleset tasks

Hi,
this is feature request to support the use of the "execute program" rsyslog feature, which is an alternative to the omprog output module.

While the omprog output module is great for programs which read from STDIN, it's not usable for software that relies on the log message being sent as an argument.

Outside of rulesets, the feature can be already used with this module via the $custom_config hash.

I have written a simple patch for this - I will attach the patch shortly.

Kind regards,
itbane

  • Puppet: 5.3
  • Ruby: 2.3.3
  • Distribution: Debian Stretch
  • Module version: 3.1.1

Question: How to add stop directive to an action?

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5
  • Distribution: CentOS 7
  • Module version: 3.3.0

How to reproduce (e.g Puppet code you use)

I am attempting to re-create the following legacy config via this module:

$ActionQueueFileName fwdRule1
$ActionQueueMaxDiskSpace 1g
$ActionQueueSaveOnShutdown on
$ActionQueueType LinkedList
$ActionResumeRetryCount -1
local0.* @syslog.domain.internal:514
& stop

The rainerscript equivalent should look like this:

local0.*                       action(type="omfwd"
                                           queue.filename="fwdRule1"
                                           queue.maxDiskSpace="1g"
                                           queue.saveOnShutdown="on"
                                           queue.type="LinkedList"
                                           action.resumeRetryCount="-1"
                                           target="syslog1.resources.internal"
                                           port="514"
                                     )

  stop

I think this hiera configuration is almost there:

syslog::server::actions:
  http_logs:
    type: omfwd
    facility: 'local0.*'
    config:
      queue.filename: 'fwdRule1'
      queue.maxDiskSpace: '1g'
      queue.saveOnShutdown: 'on'
      queue.type: 'LinkedList'
      action.resumeRetryCount: '-1'
      target: 'syslog.domain.internal'
      port: '514'

How can I add the 'stop' directive after the action?

How to use conditions ?

Hi,

for my central syslog server I need to add some logic to send clients logs into a specific file, and to send system logs into classic path.

I found a way to do this with rsyslog syntax :

if $hostname == 'myserver' then {
# local config goes here
} else
{
# remote_filter send logs to specific path
*.*     ?remote
}

The issue is I don't have any idea on how to do this with the module.
Any idea ?

Filters require a unique name when used in rulesets.

The templates for both Property and Expression filters require a unique name, even when used within a ruleset.

That makes sense when creating a Property Filter or Expression Filter Resource, but it doesn't make any sense when the filter is part of a Ruleset resource.

Cyclic dependency

Hello
I'm getting cyclic dependency issues when doing a new install (RHEL7).

I copied the yaml file from the example:

rsyslog::client::global_config:
  FileOwner:
    value: 'root'
    type: legacy
 ......
rsyslog::client::modules:
    imuxsock: {}
    imklog: {}
    
rsyslog::client::legacy_config:
  auth_priv_rule:
    key: "auth,authpriv.*"
    value: "/var/log/auth.log"
    .....

In my profiles I included the following

include rsyslog::client

When running on the node It gave me the following:

Error: Found 1 dependency cycle:
(Concat_file[/etc/rsyslog.d/50_rsyslog.conf] => Concat[/etc/rsyslog.d/50_rsyslog.conf] => Rsyslog::Generate_concat[rsyslog::concat::module::imuxsock] => Concat::Fragment[rsyslog::component::module::imuxsock] => Concat_fragment[rsyslog::component::module::imuxsock] => Concat_file[/etc/rsyslog.d/50_rsyslog.conf])\nCycle graph written to /opt/puppetlabs/puppet/cache/state/graphs/cycles.dot.
Error: Failed to apply catalog: One or more resource dependency cycles detected in graph

Here is the .dot file content

digraph Resource_Cycles {
  label = "Resource Cycles"
"Concat_file[/etc/rsyslog.d/50_rsyslog.conf]" -> "File[/etc/rsyslog.d/50_rsyslog.conf]" -> "Concat[/etc/rsyslog.d/50_rsyslog.conf]" -> "Rsyslog::Generate_concat[rsyslog::concat::module::imuxsock]" -> "Concat::Fragment[rsyslog::component::module::imuxsock]" -> "Concat_fragment[rsyslog::component::module::imuxsock]" -> "Concat_file[/etc/rsyslog.d/50_rsyslog.conf]"
"Concat_file[/etc/rsyslog.d/50_rsyslog.conf]" -> "Concat[/etc/rsyslog.d/50_rsyslog.conf]" -> "Rsyslog::Generate_concat[rsyslog::concat::module::imuxsock]" -> "Concat::Fragment[rsyslog::component::module::imuxsock]" -> "Concat_fragment[rsyslog::component::module::imuxsock]" -> "Concat_file[/etc/rsyslog.d/50_rsyslog.conf]"
}

I fixed this by removing the before statement from the component/module.pp file
/rsyslog/manifests/component/module.pp line 21

rsyslog::generate_concat { "rsyslog::concat::module::${name}":
    confdir => $confdir,
    target  => $target,
   (-)  before  => Concat::Fragment["rsyslog::component::module::${name}"],
  }

Module doesn't have a clean way to configure sysklogd options for client configuration

At the moment the only way to have client side sysklogd options is to write as a custom config like below. it would be handy to pass sysklogd options as well as a list, as a lot of old configuration uses that format.

rsyslog::client::custom_config:
  programname:
    priority: 28
    content: |
      # First some standard log files.  Log by facility.
      auth,authpriv.*                 /var/log/auth.log
      *.*;auth,authpriv.none          /var/log/syslog
      syslog.*                        /var/log/rsyslog.log #rsyslog error messages
      #cron.*                         /var/log/cron.log
      #daemon.*                       /var/log/daemon.log
      kern.*                          /var/log/kern.log
      #lpr.*                          /var/log/lpr.log
      mail.*                          /var/log/mail.log
      #user.*                         /var/log/user.log

check fedora support

this module once listed fedora in the metadata.json. We removed it because all listed versions are EOL. We need to check if recent fedora versions work and add them back.

actions component should have the option to specify logger facitility

action should have the option to specify the optional logger facility to support the rainerscript format.

*.* action(type="omelasticsearch"
  template="plain-syslog"
  searchIndex="logstash-index"
  queue.type="linkedlist"
  queue.spoolDirectory="/var/log/rsyslog/queue"
  queue.filename="dbq"
  queue.maxdiskspace="100g"
  queue.maxfilesize="100m"
  queue.SaveOnShutdown="on"
  server="192.168.1.254"
  action.resumeretrycount="-1"
  bulkmode="on"
  dynSearchIndex="on"
)


auth,authpriv.*                 action(type="omfile" dynaFile="remoteAuth" )
*.*;auth,authpriv.none          action(type="omfile" dynaFile="remoteSyslog" )
kern.*                          action(type="omfile" dynaFile="remoteKern" )

Non yaml examples please

Better examples not using yaml
I'm new to puppet and it looks like a really thought out module
but the examples are all yaml based.

would be great to have examples using puppet code.

No way to not use hiera and how to create a separate configuration file per service?

This is not a bug but a general design question of the module so I left out the issue template.

It is not clear how or if I can 1) create a separate configuration file per service 2) not use hiera.

I would like to be able to not use hiera to declare classes if possible. This seems to be an issue because there is only one public class to be used which is rsyslog::client::global_config. I could use that in a regular puppet manifest but not really because I would get duplicate class declarations if I wanted to create a profile for each rsyslog service to be monitored (which I would like to do so I can have a base profile that is always applied).

Basically I would like to do the following (not exactly this because obviously this would cause a duplicate class declaration)

# profile::rsyslog::base.pp
# this class would end up on every node
class profile::rsyslog::base{

  class { 'rsyslog::client::global_config':
    # base rsyslog config that should be on every host
  }
}
# profile::rsyslog::haproxy.pp
# this class would end up on nodes with haproxy role
class profile::rsyslog::haproxy{

  class { 'rsyslog::client::global_config':
    # rsyslog config for haproxy in a seperate config file than the base stuff(same file would be better than using hiera but I don't think that is possible here either without using hiera)
  }
}
# data/common.yaml
---
classes:
  -profile::rsyslog::base
# roles/haproxy.yaml
---
classes:
  -profile::rsyslog::haproxy

Am I missing something and is something like this possible? Take my opinion with a grain of salt because I am newish to puppet and very new to rsyslog but it seems this puppet module could use a define such as rsyslog::client::custom_service that lets you add separate config files per service.

Handling permissions on startup

Anyone have any thoughts about how this could also handle the permissions on the existing files? I know we can set new files to a user and permissions, but on boot the files are created and so you'll get a permission denied until the file gets rotated.

facility not present in out put of rulsets when using - action

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: puppet/rsyslog
  • Module version: 2.3.0

What are you seeing

Facility not presented when using

rsyslog::rulesets_defaults:
local_rules:
parameters:
queue.size: '1000'
queue.type: LinkedList
rules:
- action:
facility: '.;auth,authpriv.none'
name: cron_logs
type: omfile
config:
file: '/var/log/cron'

it generated the following

local_rules ruleset

ruleset (name="local_rules"
queue.size="1000"
queue.type="LinkedList"
) {
action(type="omfile"
file="/var/log/cron" )
}

found two issues... type-o in puppet-rsyslog/templates/tasks.epp
facility is spelled faclility at Line 14

<%- if $cfgval['facility'] == undef or '' { $facility = 'default' } else { $facility = $cfgval['faclility'] } -%>

and bad test in puppet-rsyslog/templates/tasks.epp
line 14
< %- if $cfgval['facility'] == undef or '' { $facility = 'default' } else { $facility = $cfgval['faclility'] } -%>
always returns default.
changed to
<%- if ! $cfgval['facility'] or $cfgval['facility'] == '' { $facility = 'default' } else { $facility = $cfgval['facility'] } -%>

What behaviour did you expect instead

i expected the foillowing

local_rules ruleset

ruleset (name="local_rules"
queue.size="1000"
queue.type="LinkedList"
) {
.;auth,authpriv.none action(type="omfile" file="/var/log/cron" )
}

Any additional information you'd like to impart

this is my first time reporting ... be kind.

file backup is not working correctly when existing files exist

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.14, PE 2019.4
  • Ruby: 2.4
  • Distribution: RHEL 7
  • Module version: 5.1.0

How to reproduce (e.g Puppet code you use)

In site.pp have the following configuration.

File{
  backup => '.old'
}
use defaults for module

Add a listen.conf file in /etc/rsyslog.d/listen.conf

What are you seeing

Puppet backs up this file and places in same directory. Puppet then backs up the same file and appends another '.old' extension on top of the previous one. After several iterations of this you end up with.

listen.conf.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old.old

What behaviour did you expect instead

Only a single listen.conf.old file would be reproduced.

Output log

Any additional information you'd like to impart

Error: Evaluation Error: Resource type not found: PrivDropToUser (file: /tmp/kitchen/manifests/site.pp, line: 141, column: 9) on node 21a40dd4ec00

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.1
  • Ruby: 2.4.1p1
  • Distribution: Centos/Ubuntu
  • Module version: latest

How to reproduce (e.g Puppet code you use)

  class { 'rsyslog::server':
    global_config   => {
        umask => {
            value => '0022',
            type => legacy,
            priority => 01, 
        },  
        PrivDropToUser => {
            value => 'syslog',
            type => legacy,
        },  
        PrivDropToGroup => {
            value => 'syslog',
            type => legacy,
        },  
        workDirectory => {
            value => '/var/spool/rsyslog',
        },  
        maxMessageSize => {
            value => '64k',
        }   
    },

What are you seeing

above message

What behaviour did you expect instead

rsyslog should be configured with given unprivileged user.
On Debian/Ubuntu, it's the default

Output log

(centos7) https://travis-ci.org/juju4/puppet-meta-harden-linux/jobs/420572879#L2727
(bionic) https://travis-ci.org/juju4/puppet-meta-harden-linux/jobs/420572880#L3246
(xenial) https://travis-ci.org/juju4/puppet-meta-harden-linux/jobs/420572881#L3053

Any additional information you'd like to impart

Can't create an expressión filter with more than one 'else if'

Hi,

I need to create a ruleset with a rule with an expression with more than just one else if. Somethin like:

if $hostname == ["sip", "proxysipint", "proxysipintb" ] then {
  set $.filename = "kam-int.log";

    }
else if $hostname == ["sipext", "proxysipext" ] then {
  set $.filename = "kam-ext.log";

    }
else if $hostname == ["pbxum", "pbxum1", "pbxum1b"] then {
  set $.filename = "ast-core.log";

    }

So, my code is like:

  - expression_filter:
      filter:
        if:
          expression: '$hostname == ["sip", "proxysipint", "proxysipintb" ]'
          tasks:
            - set:
                '$.filename': '"kam-int.log"'
        'else if':
          expression: '$hostname == ["sipext", "proxysipext" ]'
          tasks:
            - set:
                '$.filename': '"kam-ext.log"'
        'else if':
          expression: '$hostname == ["pbxum", "pbxum1", "pbxum1b"]'
          tasks:
            - set:
                '$.filename': '"ast-core.log"'

the problem with this hiera is that I have to use the same else if key for two different hash elements, so the second overrides the first.

I've been looking for a way to create such an expression, but as the template for an expression is:

<%- |
$filter_name,
$conditionals
| -%>
# <%= $filter_name %>
<%- $conditionals.each |$conditional, $options| { -%>
  <%- if $conditional == 'else' { -%>
<%= $conditional %> {
  <%- } else { -%>
<%= "${conditional} ${options['expression']} then" %> {
  <%-}-%>
<%- $options['tasks'].each |$task| { -%>
<%= epp('rsyslog/tasks.epp', { 'tasks' => $task }) -%>
<%-}-%>
}
<%}-%>

I can't find any way to do it, because the conditional clause is taken always from the key of the element in the hash.

Is there any way to create such config?

No clue how to configure a client with this module

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: PE 2017.2.1
  • Ruby: 2.1.9p490 (from pe-agent)
  • Distribution: RHEL 7.4
  • Module version: 2.3.1

How to reproduce (e.g Puppet code you use)

class { 'rsyslog::client': }

What are you seeing

/etc/rsyslog.d/00_client.conf
and I cannot figure out how it was generated or how to modify it to do something simple like specify the remote log server

Dependency circle with action class

Hi

I believe I tried the most basic setup of this module but everytime I call rsyslog::client::actions I have a dependency circle.

(Concat_file[/etc/rsyslog.d/50_rsyslog.conf] => Concat[/etc/rsyslog.d/50_rsyslog.conf] => Rsyslog::Generate_concat[rsyslog::concat::action::mail_logs] => Concat::Fragment[rsyslog::component::action::mail_logs] => Concat_fragment[rsyslog::component::action::mail_logs] => Concat_file[/etc/rsyslog.d/50_rsyslog.conf])

I have these two piece of code:

profile.pp

class { 'rsyslog::client': }

common.yaml

rsyslog::client::actions:
  mail_logs:
    type: "omfile"
    facility: "mail.*"
    config:
      file: "/var/log/testlog"

Ruleset expression filter: problem with documention

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.2.0
  • Ruby: 2.5.3
  • Distribution: Ubuntu 16.04
  • Module version: 3.3.0

How to reproduce (e.g Puppet code you use)

Straight from the documentation for ruleset expression filters:

rsyslog::server::rulesets:
  ruleset_eth0_514_udp:
    parameters:
      queue.type: LinkedList
    rules:
      - expression_filter:
          if:
            expression: '$fromhost-ip == "192.168.255.1"'
            tasks:
              - call: "ruleset.action.rawlog.standard"
              - stop: true
      - call: "ruleset.client.log.standard"
      - call: "ruleset.unknown.standard"

What are you seeing

An error message.

What behaviour did you expect instead

No error :)

Output log

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Method call, 'each' expects one of:
  (Hash hash, Callable[2, 2] block)
    rejected: parameter 'hash' expects a Hash value, got Undef
  (Hash hash, Callable[1, 1] block)
    rejected: parameter 'hash' expects a Hash value, got Undef
  (Iterable enumerable, Callable[2, 2] block)
    rejected: parameter 'enumerable' expects an Iterable value, got Undef
  (Iterable enumerable, Callable[1, 1] block)
    rejected: parameter 'enumerable' expects an Iterable value, got Undef (file: /etc/puppetlabs/code/environments/production/modules/rsyslog/templates/expression_filter.epp, line: 6, column: 18) (file: /etc/puppetlabs/code/environments/production/modules/rsyslog/manifests/config/rulesets.pp, line: 3) on node canvasci-its.ocad.ca

Any additional information you'd like to impart

It seems that the module is expecting an additional key that is not present in the documention. The following will work:

rsyslog::server::rulesets:
  ruleset_eth0_514_udp:
    parameters:
      queue.type: LinkedList
    rules:
      - expression_filter:
          filter:
            if:
              expression: '$fromhost-ip == "192.168.255.1"'
              tasks:
                - call: "ruleset.action.rawlog.standard"
                - stop: true
      - call: "ruleset.client.log.standard"
      - call: "ruleset.unknown.standard"

Note the addition of the filter key below expression_filter. I'm not sure if the filter key needs to be added to the docs, or if

<%= epp('rsyslog/expression_filter.epp', { 'filter_name' => 'Expression-based Filter', 'conditionals' => $params['filter'] }) -%>
needs to be updated to remove the reference to the filter key.

Thanks!

Purging config files does not restart rsyslogd

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 6.10.0
  • Ruby: 2.5.5p157
  • Distribution: Debian 10
  • Module version: 5.0.1

How to reproduce (e.g Puppet code you use)

rsyslog with mostly default settings (in particular purge_config_files is true).

What are you seeing

When the puppet modules purges config files in /etc/rsyslog.d/, it does not restart rsyslogd.

What behaviour did you expect instead

It should restart rsyslogd.

warning with recent puppet

Affected Puppet, Ruby, OS and module versions/distributions

How to reproduce (e.g Puppet code you use)

https://github.com/juju4/puppet-meta-harden-linux/blob/devel/manifests/site.pp#L142
but compilation warning related to module so not expecting to be config dependent

issue is on
https://github.com/voxpupuli/puppet-rsyslog/blob/master/hiera.yaml
and should be for v5 like
https://github.com/juju4/puppet-meta-harden-linux/blob/devel/hiera.yaml

Thanks

What are you seeing

https://travis-ci.org/juju4/puppet-meta-harden-linux/jobs/423360920#L3318

       Warning: /tmp/kitchen/modules/rsyslog/hiera.yaml: Use of 'hiera.yaml' version 4 is deprecated. It should be converted to version 5
          (file: /tmp/kitchen/modules/rsyslog/hiera.yaml)
       Warning: Defining "data_provider": "hiera" in metadata.json is deprecated.
          (file: /tmp/kitchen/modules/rsyslog/metadata.json)

What behaviour did you expect instead

no warnings

Output log

above

Global Hash creates multiple global tags in the config

Rather than passing all the values in the global hash inside the global tag it creates a global tag per entry in the syslog config file.

rsyslog::server::global_config:
  umask:
    value: '0000'
    type: legacy
    priority: 01
  RepeatedMsgReduction:
    value: 'on'
    type: legacy
  PrivDropToUser:
    value: 'syslog'
    type: legacy
  PrivDropToGroup:
    value: 'syslog'
    type: legacy
  parser.escapeControlCharactersOnReceive:
    value: 'on'
  workDirectory:
    value: '/var/spool/rsyslog'
  maxMessageSize:
    value: '64k'

the above code produces content like below

$PrivDropToGroup syslog
$PrivDropToUser syslog
$RepeatedMsgReduction on
global (
  maxMessageSize="64k"
)
global (
  parser.escapeControlCharactersOnReceive="on"
)
global (
  workDirectory="/var/spool/rsyslog"
)
$umask 0000

but it should be like this

$PrivDropToGroup syslog
$PrivDropToUser syslog
$RepeatedMsgReduction on
global (
  maxMessageSize="64k"
  parser.escapeControlCharactersOnReceive="on"
  workDirectory="/var/spool/rsyslog"
)
$umask 0000

Module does not work on RHEL 7

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.6 (PE 2018.1.4)
  • Module version: 3.2.0

How to reproduce (e.g Puppet code you use)

dwhite2.sec.dte.cert.org.yaml.txt

What are you seeing

etc-rsyslog.conf.txt

and /etc/rsyslog.d/ is empty

What behaviour did you expect instead

Previous /etc/rsyslog.conf: (trimmed of comment lines)
etc-rsyslog.conf-orig.txt
Previous /etc/rsyslog.d/listen.conf:
etc-rsyslog.d-listen.conf-orig.txt

Output log

puppet-run-2018-09-07-09-48-15.txt
Use "less -r" to view without garbage

`target` key doesn't work in component hashes

The target key in a component hash (templates, actions, modules, etc) doesn't properly work when overridden.

If target is not supposed to be configurable at the component level

No error message is displayed, the component defined in the hash simple doesn't get created due to the lack of a parent concat resource that matches the concat::fragment's target attribute.

If target is supposed to be configurable at the component level

No parent concat resource exists for the concat::fragment that is generated, thus the config is not generated in a configuration file.

Release summary for 5.0.1

v5.0.0 was never released to the forge due to an issue with the release process. v5.0.1 contains no functional changes.

Unable to provide options along with the load module

Unable to provide additional options along with the load module

module ( load="imudp" 
          threads="2"
          TimeRequery="8"
          batchSize="128"

)
module ( load="builtin:omfile" 
          fileOwner="syslog"
          fileGroup="adm"
          dirGroup="adm"
          fileCreateMode="0640"
          dirCreateMode="0755"

)

Cannot set syslog conf file and directory permissions

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: agent 6.4.3 (Puppet Enterprise 2019.1)
  • Ruby:
  • Distribution: RHEL 7,8
  • Module version: 4.0.0 (appears to be an issue in 5.0.0 as well)

How to reproduce (e.g Puppet code you use)

include rsyslog::client

What are you seeing

/etc/rsyslog.conf, /etc/rsyslog.d, /etc/rsyslog.d permissions cannot be set
We use 0600 on our files, but can't set that.

What behaviour did you expect instead

Conf file Permissions exposed as a parameter

Output log

Any additional information you'd like to impart

deprecated Object#=~ is called on - it always returns nil (Puppet 7.0+)

  • Puppet: 7+
  • Ruby: ?
  • Distribution: CentOS 8
  • Module version: 5.1.0

How to reproduce (e.g Puppet code you use)

include ::rsyslog

What are you seeing

puppet agent -t

/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on TrueClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil
/opt/puppetlabs/puppet/cache/lib/facter/rsyslog.rb:29: warning: deprecated Object#=~ is called on FalseClass; it always returns nil

What behaviour did you expect instead

no errors

Support for Puppet 7+

Hi,

I would like to use this module with Puppet 7.10.0.

Are there any plans to update this to work with it or know of any which would work with Puppet 7.10.0?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.