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            => "prifilt('local4.*')",
  target_log_file => '/var/log/slapd.log',
  stop_processing => true
}

Parameters:

  • name (String)

    The filename that you will be dropping into place

  • rule (Optional[String]) (defaults to: undef)

    The Rsyslog EXPRESSION to filter on

    • NOTE: Do NOT include the leading if/then

      • Correct: "rule => "prifilt('.')"

      • Incorrect: rule => "if prifilt('.') then"

      • Correct: "rule => "prifilt('.')"

      • Incorrect: rule => "if prifilt('.') then"

    • This must be set if $content is left empty

  • 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)

    Set a dynamic filename using the property replacer rules

    • NOTE: If you make this the filename path itself, a template will automatically be created for you. Otherwise, you must make sure to have a rsyslog template in place and pass the name of the template to this option

    • Rsyslog templates can be created using the rsyslog::template::* defined types

  • template (Optional[String]) (defaults to: undef)
  • dyna_file_cache_size (Integer[0]) (defaults to: 10)
  • zip_level (Integer[0,9]) (defaults to: 0)
  • very_robust_zip (Boolean) (defaults to: true)
  • flush_interval (Integer[0]) (defaults to: 0)
  • async_writing (Boolean) (defaults to: false)
  • flush_on_tx_end (Boolean) (defaults to: true)
  • io_buffer_size (Optional[Integer[0]]) (defaults to: undef)
  • dir_owner (Optional[String]) (defaults to: undef)
  • dir_owner_num (Optional[Integer[0]]) (defaults to: undef)
  • dir_group (Optional[String]) (defaults to: undef)
  • dir_group_num (Optional[Integer[0]]) (defaults to: undef)
  • file_owner (Optional[String]) (defaults to: undef)
  • file_owner_num (Optional[Integer[0]]) (defaults to: undef)
  • file_group (Optional[String]) (defaults to: undef)
  • file_group_num (Optional[Integer[0]]) (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[Integer[0]]) (defaults to: undef)
  • queue_dequeue_batch_size (Integer[0]) (defaults to: 16)
  • queue_max_disk_space (Optional[Integer[0]]) (defaults to: undef)
  • queue_high_watermark (Optional[Integer[0]]) (defaults to: undef)
  • queue_low_watermark (Integer[0]) (defaults to: 2000)
  • queue_full_delay_mark (Optional[Integer[0]]) (defaults to: undef)
  • queue_light_delay_mark (Optional[Integer[0]]) (defaults to: undef)
  • queue_discard_mark (Integer[0]) (defaults to: 9750)
  • queue_discard_severity (Integer[0]) (defaults to: 8)
  • queue_checkpoint_interval (Optional[Integer[0]]) (defaults to: undef)
  • queue_sync_queue_files (Boolean) (defaults to: false)
  • queue_type (Enum['FixedArray','LinkedList','Direct','Disk']) (defaults to: 'Direct')
  • queue_worker_threads (Integer[0]) (defaults to: 1)
  • queue_timeout_shutdown (Integer[0]) (defaults to: 0)
  • queue_timeout_action_completion (Integer[0]) (defaults to: 1000)
  • queue_timeout_enqueue (Integer[0]) (defaults to: 2000)
  • queue_timeout_worker_thread_shutdown (Integer[0]) (defaults to: 60000)
  • queue_worker_thread_minimum_messages (Integer[0]) (defaults to: 100)
  • queue_max_file_size (String) (defaults to: '1m')
  • queue_save_on_shutdown (Boolean) (defaults to: false)
  • queue_dequeue_slowdown (Integer[0]) (defaults to: 0)
  • queue_dequeue_time_begin (Optional[Integer[0]]) (defaults to: undef)
  • queue_dequeue_time_end (Optional[Integer[0]]) (defaults to: undef)
  • content (Optional[String]) (defaults to: undef)

    the *entire content of the rsyslog::rule

    • If you do not specify this, $rule is a required variable

    • If you do specify this, $rule will be ignored

See Also:



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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'manifests/rule/local.pp', line 115

define rsyslog::rule::local (
  Optional[String]                                $rule                                 = undef,
  Optional[Stdlib::Absolutepath]                  $target_log_file                      = undef,
  Boolean                                         $stop_processing                      = false,
  Optional[String]                                $dyna_file                            = undef,
  Optional[String]                                $template                             = undef,
  Integer[0]                                      $dyna_file_cache_size                 = 10,
  Integer[0,9]                                    $zip_level                            = 0,
  Boolean                                         $very_robust_zip                      = true,
  Integer[0]                                      $flush_interval                       = 0,
  Boolean                                         $async_writing                        = false,
  Boolean                                         $flush_on_tx_end                      = true,
  Optional[Integer[0]]                            $io_buffer_size                       = undef,
  Optional[String]                                $dir_owner                            = undef,
  Optional[Integer[0]]                            $dir_owner_num                        = undef,
  Optional[String]                                $dir_group                            = undef,
  Optional[Integer[0]]                            $dir_group_num                        = undef,
  Optional[String]                                $file_owner                           = undef,
  Optional[Integer[0]]                            $file_owner_num                       = undef,
  Optional[String]                                $file_group                           = undef,
  Optional[Integer[0]]                            $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[Integer[0]]                            $queue_size                           = undef,
  Integer[0]                                      $queue_dequeue_batch_size             = 16,
  Optional[Integer[0]]                            $queue_max_disk_space                 = undef,
  Optional[Integer[0]]                            $queue_high_watermark                 = undef,
  Integer[0]                                      $queue_low_watermark                  = 2000,
  Optional[Integer[0]]                            $queue_full_delay_mark                = undef,
  Optional[Integer[0]]                            $queue_light_delay_mark               = undef,
  Integer[0]                                      $queue_discard_mark                   = 9750,
  Integer[0]                                      $queue_discard_severity               = 8,
  Optional[Integer[0]]                            $queue_checkpoint_interval            = undef,
  Boolean                                         $queue_sync_queue_files               = false,
  Enum['FixedArray','LinkedList','Direct','Disk'] $queue_type                           = 'Direct',
  Integer[0]                                      $queue_worker_threads                 = 1,
  Integer[0]                                      $queue_timeout_shutdown               = 0,
  Integer[0]                                      $queue_timeout_action_completion      = 1000,
  Integer[0]                                      $queue_timeout_enqueue                = 2000,
  Integer[0]                                      $queue_timeout_worker_thread_shutdown = 60000,
  Integer[0]                                      $queue_worker_thread_minimum_messages = 100,
  String                                          $queue_max_file_size                  = '1m',
  Boolean                                         $queue_save_on_shutdown               = false,
  Integer[0]                                      $queue_dequeue_slowdown               = 0,
  Optional[Integer[0]]                            $queue_dequeue_time_begin             = undef,
  Optional[Integer[0]]                            $queue_dequeue_time_end               = undef,
  Optional[String]                                $content                              = undef
) {

  unless ($rule or $content) {
    fail('You must specify "$rule" if you are not specifying "$content"')
  }

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

  if $content {
    $_content = $content
  }
  else {
    if !($dyna_file or $target_log_file) {
      fail('You must specify one of $dyna_file or $target_log_file')
    }
    $_content = template("${module_name}/rule/local.erb")
  }

  rsyslog::rule { "99_simp_local/${_safe_name}.conf":
    content => $_content
  }
}