Defined Type: rsyslog::rule::local

Defined in:
manifests/rule/local.pp

Overview

Add a rule targeting writing local system logs

NOTE: Any option that is not explicitly documented here matches the ruleset options in the Rsyslog documentation.

In general, the order will be:

  • Data Source Rules

  • Console Rules

  • Drop Rules

  • Remote Rules

  • Other/Miscellaneous Rules

  • Local Rules

Examples:

Capture OpenLDAP Logs Then Stop Processing

rsyslog::rule::local { 'collect_openldap':
  rule            => "if prifilt('local4.*') then",
  target_log_file => '/var/log/slapd.log',
  stop_processing => true
}

Parameters:

  • name (Stdlib::Absolutepath)

    The filename that you will be dropping into place

  • rule (String)

    The Rsyslog EXPRESSION to filter on

  • target_log_file (Optional[Stdlib::Absolutepath]) (defaults to: undef)

    The target log file that omfile will be writing to

    • This must be set if $dyna_file is left empty

  • stop_processing (Boolean) (defaults to: false)

    Do not forward logs to any further rulesets after processing this ruleset.

  • dyna_file (Optional[String]) (defaults to: undef)
  • template (Optional[String]) (defaults to: undef)
  • dyna_file_cache_size (Stdlib::Compat::Integer) (defaults to: '10')
  • zip_level (Stdlib::Compat::Integer) (defaults to: '0')
  • very_robust_zip (Boolean) (defaults to: true)
  • flush_interval (Stdlib::Compat::Integer) (defaults to: '0')
  • async_writing (Boolean) (defaults to: false)
  • flush_on_tx_end (Boolean) (defaults to: true)
  • io_buffer_size (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • dir_owner (Optional[String]) (defaults to: undef)
  • dir_owner_num (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • dir_group (Optional[String]) (defaults to: undef)
  • dir_group_num (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • file_owner (Optional[String]) (defaults to: undef)
  • file_owner_num (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • file_group (Optional[String]) (defaults to: undef)
  • file_group_num (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • file_create_mode (String) (defaults to: '0644')
  • dir_create_mode (String) (defaults to: '0700')
  • fail_on_chown_failure (Boolean) (defaults to: true)
  • create_dirs (Boolean) (defaults to: true)
  • sync (Boolean) (defaults to: false)
  • sig_provider (Optional[String]) (defaults to: undef)
  • cry_provider (Optional[String]) (defaults to: undef)
  • queue_filename (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • queue_spool_directory (Optional[Stdlib::Absolutepath]) (defaults to: undef)
  • queue_size (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_dequeue_batch_size (Stdlib::Compat::Integer) (defaults to: '16')
  • queue_max_disk_space (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_high_watermark (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_low_watermark (Stdlib::Compat::Integer) (defaults to: '2000')
  • queue_full_delay_mark (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_light_delay_mark (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_discard_mark (Stdlib::Compat::Integer) (defaults to: '9750')
  • queue_discard_severity (Stdlib::Compat::Integer) (defaults to: '8')
  • queue_checkpoint_interval (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_sync_queue_files (Boolean) (defaults to: false)
  • queue_type (Enum['FixedArray','LinkedList','Direct','Disk']) (defaults to: 'Direct')
  • queue_worker_threads (Stdlib::Compat::Integer) (defaults to: '1')
  • queue_timeout_shutdown (Stdlib::Compat::Integer) (defaults to: '0')
  • queue_timeout_action_completion (Stdlib::Compat::Integer) (defaults to: '1000')
  • queue_timeout_enqueue (Stdlib::Compat::Integer) (defaults to: '2000')
  • queue_timeout_worker_thread_shutdown (Stdlib::Compat::Integer) (defaults to: '60000')
  • queue_worker_thread_minimum_messages (Stdlib::Compat::Integer) (defaults to: '100')
  • queue_max_file_size (String) (defaults to: '1m')
  • queue_save_on_shutdown (Boolean) (defaults to: false)
  • queue_dequeue_slowdown (Stdlib::Compat::Integer) (defaults to: '0')
  • queue_dequeue_time_begin (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • queue_dequeue_time_end (Optional[Stdlib::Compat::Integer]) (defaults to: undef)

See Also:



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'manifests/rule/local.pp', line 91

define rsyslog::rule::local (
  String $rule,
  Optional[Stdlib::Absolutepath]                  $target_log_file                      = undef,
  Boolean                                         $stop_processing                      = false,
  Optional[String]                                $dyna_file                            = undef,
  Optional[String]                                $template                             = undef,
  Stdlib::Compat::Integer                         $dyna_file_cache_size                 = '10',
  Stdlib::Compat::Integer                         $zip_level                            = '0',
  Boolean                                         $very_robust_zip                      = true,
  Stdlib::Compat::Integer                         $flush_interval                       = '0',
  Boolean                                         $async_writing                        = false,
  Boolean                                         $flush_on_tx_end                      = true,
  Optional[Stdlib::Compat::Integer]               $io_buffer_size                       = undef,
  Optional[String]                                $dir_owner                            = undef,
  Optional[Stdlib::Compat::Integer]               $dir_owner_num                        = undef,
  Optional[String]                                $dir_group                            = undef,
  Optional[Stdlib::Compat::Integer]               $dir_group_num                        = undef,
  Optional[String]                                $file_owner                           = undef,
  Optional[Stdlib::Compat::Integer]               $file_owner_num                       = undef,
  Optional[String]                                $file_group                           = undef,
  Optional[Stdlib::Compat::Integer]               $file_group_num                       = undef,
  String                                          $file_create_mode                     = '0644',
  String                                          $dir_create_mode                      = '0700',
  Boolean                                         $fail_on_chown_failure                = true,
  Boolean                                         $create_dirs                          = true,
  Boolean                                         $sync                                 = false,
  Optional[String]                                $sig_provider                         = undef,
  Optional[String]                                $cry_provider                         = undef,
  Optional[Stdlib::Absolutepath]                  $queue_filename                       = undef,
  Optional[Stdlib::Absolutepath]                  $queue_spool_directory                = undef,
  Optional[Stdlib::Compat::Integer]               $queue_size                           = undef,
  Stdlib::Compat::Integer                         $queue_dequeue_batch_size             = '16',
  Optional[Stdlib::Compat::Integer]               $queue_max_disk_space                 = undef,
  Optional[Stdlib::Compat::Integer]               $queue_high_watermark                 = undef,
  Stdlib::Compat::Integer                         $queue_low_watermark                  = '2000',
  Optional[Stdlib::Compat::Integer]               $queue_full_delay_mark                = undef,
  Optional[Stdlib::Compat::Integer]               $queue_light_delay_mark               = undef,
  Stdlib::Compat::Integer                         $queue_discard_mark                   = '9750',
  Stdlib::Compat::Integer                         $queue_discard_severity               = '8',
  Optional[Stdlib::Compat::Integer]               $queue_checkpoint_interval            = undef,
  Boolean                                         $queue_sync_queue_files               = false,
  Enum['FixedArray','LinkedList','Direct','Disk'] $queue_type                           = 'Direct',
  Stdlib::Compat::Integer                         $queue_worker_threads                 = '1',
  Stdlib::Compat::Integer                         $queue_timeout_shutdown               = '0',
  Stdlib::Compat::Integer                         $queue_timeout_action_completion      = '1000',
  Stdlib::Compat::Integer                         $queue_timeout_enqueue                = '2000',
  Stdlib::Compat::Integer                         $queue_timeout_worker_thread_shutdown = '60000',
  Stdlib::Compat::Integer                         $queue_worker_thread_minimum_messages = '100',
  String                                          $queue_max_file_size                  = '1m',
  Boolean                                         $queue_save_on_shutdown               = false,
  Stdlib::Compat::Integer                         $queue_dequeue_slowdown               = '0',
  Optional[Stdlib::Compat::Integer]               $queue_dequeue_time_begin             = undef,
  Optional[Stdlib::Compat::Integer]               $queue_dequeue_time_end               = undef
) {

  if !($dyna_file or $target_log_file) {
    fail('You must specify one of $dyna_file or $target_log_file')
  }

  $_safe_name = regsubst($name,'/','__')

  rsyslog::rule { "99_simp_local/${_safe_name}.conf":
    content => template("${module_name}/rule/local.erb")
  }
}