Puppet Class: tlog::config::rsyslog

Defined in:
manifests/config/rsyslog.pp

Overview

Manage local syslog hooks for tlog

Parameters:

  • logrotate_options (Hash)

    Options to pass to the ‘logrotate::rule` defined type

    • Will be deep merged through Hiera by default

    • The ‘log_files` option will not be honored if passed

    @see ‘data/common.yaml`

  • match_rule (String[1]) (defaults to: '$programname == \'tlog-rec-session\' or $programname == \'-tlog-rec-session\' or $programname == \'tlog\'')

    The rule that should be used for matching TLOG rules

    • The default is set to match rules on the widest selection of systems possible.

  • log_file (Stdlib::Absolutepath) (defaults to: '/var/log/tlog.log')

    The log file in which to save the ‘tlog` logs

  • logrotate_create (Pattern['\d{4} .+ .+']) (defaults to: '0640 tlog tlog')

    The create options to specify in the logrotate rule

  • stop_processing (Boolean) (defaults to: true)

    Cease processing syslog rules after processing this rule

  • logrotate (Boolean) (defaults to: simplib::lookup('simp_options::logrotate', { 'default_value' => false }))

    Enable log rotation for ‘$log_file`



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'manifests/config/rsyslog.pp', line 29

class tlog::config::rsyslog (
  Hash                   $logrotate_options,
  String[1]              $match_rule       = '$programname == \'tlog-rec-session\' or $programname == \'-tlog-rec-session\' or $programname == \'tlog\'',
  Stdlib::Absolutepath   $log_file         = '/var/log/tlog.log',
  Pattern['\d{4} .+ .+'] $logrotate_create = '0640 tlog tlog',
  Boolean                $stop_processing  = true,
  Boolean                $logrotate        = simplib::lookup('simp_options::logrotate', { 'default_value' => false })
) {
  simplib::assert_optional_dependency($module_name, 'simp/rsyslog')

  include 'rsyslog'

  # named 'XX_tlog' so that it appears before the local filesystem defaults
  rsyslog::rule::local { 'XX_tlog':
    rule            => $match_rule,
    target_log_file => $log_file,
    stop_processing => $stop_processing
  }

  if $logrotate {
    simplib::assert_optional_dependency($module_name, 'simp/logrotate')

    include 'logrotate'

    $_rule_opts = $logrotate_options + {'log_files' => [ $log_file ]} + {'create' => $logrotate_create}

    logrotate::rule { 'tlog': * => $_rule_opts }
  }
}