Defined Type: rsyslog::rule::remote

Defined in:
manifests/rule/remote.pp

Overview

Adds a rule to send messages to a remote system

In general, the order will be:

  • Data Source Rules

  • Console Rules

  • Drop Rules

  • Remote Rules

  • Other/Miscellaneous Rules

  • Local Rules


WARNING

If possible, this module will take pains to prevent adding a target that is equivalent to the current system to prevent syslog loops.

Unfortunately, there is no foolproof method for getting this correct 100% of the time so please take care when setting your destination targets.

WARNING


Examples:

Send All local0 Messages to 1.2.3.4 via TCP

rsyslog::rule::other { 'send_local0_away':
  rule =>  "if prifilt('local0.*') then @@1.2.3.4"
}

Parameters:

  • name (Stdlib::Absolutepath)

    The filename that you will be dropping into place

  • rule (String)

    The Rsyslog EXPRESSION to filter on

    • This should only be the matching part of the expression, the remaining parameters take care of ensuring that the material is properly routed.

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

    The template that should be used to format the content

  • dest (Array[String]) (defaults to: [])

    If filled, the $content will be sent to all hosts in this Array.

    • WARNING: If using this, do NOT add a destination to your rule

  • dest_type (Enum['tcp','udp','relp']) (defaults to: 'tcp')

    The destination type for all entries in $dest

    • At this time, if you wish to have different types per destination, you will need to craft your own ruleset and leave $dest empty.

  • failover_log_servers (Array[String]) (defaults to: [])

    The listed systems will be used as failover servers for all logs matching this rule

    • Uses $dest_type above

  • tcp_framing (Enum['traditional','octet-counted']) (defaults to: 'traditional')
  • zip_level (Enum['0','1','2','3','4','5','6','7','8','9']) (defaults to: '0')
  • max_error_messages (Stdlib::Compat::Integer) (defaults to: '5')
  • compression_mode (Enum['none','single','stream:always']) (defaults to: 'none')
  • compression_stream_flush_on_tx_end (Boolean) (defaults to: true)
  • rebind_interval (Optional[Stdlib::Compat::Integer]) (defaults to: undef)
  • action_resume_interval (Stdlib::Compat::Integer) (defaults to: '30')
  • action_resume_retry_count (Stdlib::Compat::Integer) (defaults to: '-1')
  • stream_driver (Optional[String]) (defaults to: undef)
  • stream_driver_mode (Stdlib::Compat::Integer) (defaults to: '1')
  • stream_driver_auth_mode (String) (defaults to: 'x509/name')
  • stream_driver_permitted_peers (String) (defaults to: "*.${::domain}")
  • resend_last_msg_on_reconnect (Boolean) (defaults to: true)
  • udp_send_to_all (Boolean) (defaults to: false)
  • queue_filename (Optional[String]) (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['LinkedList','FixedArray','Direct','Disk']) (defaults to: 'LinkedList')
  • 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: true)
  • 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)
  • stop_processing (Boolean) (defaults to: false)

See Also:



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
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
191
192
193
# File 'manifests/rule/remote.pp', line 106

define rsyslog::rule::remote (
  String $rule,
  Boolean                                         $stop_processing                      = false,
  Optional[String]                                $template                             = undef,
  Array[String]                                   $dest                                 = [],
  Enum['tcp','udp','relp']                        $dest_type                            = 'tcp',
  Array[String]                                   $failover_log_servers                 = [],
  Enum['traditional','octet-counted']             $tcp_framing                          = 'traditional',
  Enum['0','1','2','3','4','5','6','7','8','9']   $zip_level                            = '0',
  Stdlib::Compat::Integer                         $max_error_messages                   = '5',
  Enum['none','single','stream:always']           $compression_mode                     = 'none',
  Boolean                                         $compression_stream_flush_on_tx_end   = true,
  Optional[Stdlib::Compat::Integer]               $rebind_interval                      = undef,
  Stdlib::Compat::Integer                         $action_resume_interval               = '30',
  Stdlib::Compat::Integer                         $action_resume_retry_count            = '-1',
  Optional[String]                                $stream_driver                        = undef,
  Stdlib::Compat::Integer                         $stream_driver_mode                   = '1',
  String                                          $stream_driver_auth_mode              = 'x509/name',
  String                                          $stream_driver_permitted_peers        = "*.${::domain}",
  Boolean                                         $resend_last_msg_on_reconnect         = true,
  Boolean                                         $udp_send_to_all                      = false,
  Optional[String]                                $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['LinkedList','FixedArray','Direct','Disk'] $queue_type                           = 'LinkedList',
  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               = true,
  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
) {
  include '::rsyslog'

  if empty($dest) {
    $_dest = $::rsyslog::log_servers
  }
  else {
    $_dest = $dest
  }

  validate_array($_dest)
  if empty($_dest) { fail('Error: you must pass a destination array for $dest') }
  validate_net_list($_dest)

  $_queue_filename = empty($queue_filename) ? {
    true    => "${name}_disk_queue",
    default => $queue_filename
  }
  $_queue_spool_directory = empty($queue_spool_directory) ? {
    true    => $::rsyslog::queue_spool_directory,
    default => $queue_spool_directory
  }
  $_use_tls = $::rsyslog::enable_tls_logging

  if empty($failover_log_servers) {
    $_failover_servers = $::rsyslog::failover_log_servers
  }
  else {
    $_failover_servers = $failover_log_servers
  }

  if !empty($_failover_servers) {
    validate_array($_failover_servers)
    validate_net_list($_failover_servers)
  }

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

  rsyslog::rule { "10_simp_remote/${_safe_name}.conf":
    content => template("${module_name}/rule/remote.erb")
  }
}