Defined Type: rsyslog::input::file

Defined in:
modules/rsyslog/manifests/input/file.pp

Overview

SPDX-License-Identifier: Apache-2.0

rsyslog::input::file - ingest a log file with rsyslog imfile for processing/shipping

see www.rsyslog.com/doc/v8-stable/configuration/modules/imfile.html for full imfile documentation

$path - Input file path glob. Wildcards supported in both file and directories $syslog_tag_prefix - Prefix to be applied to syslog tag field (defaults to 'imfile') $syslog_tag - Desired syslog tag (useful for example with filtering/shipping) $priority - Rsyslog conf file priority number (used in filename prefix) $reopen_on_truncate - Reopen input file when it was truncated (inode unchanged but file size on disk is less than current offset in memory). $startmsg_regex - Regex pattern matching the beginning of multi-line log event. Log lines will be appended until the next match.

Parameters:

  • path (String)
  • ensure (Wmflib::Ensure) (defaults to: present)
  • reopen_on_truncate (Enum['on','off']) (defaults to: 'on')
  • syslog_tag_prefix (Pattern[/[a-zA-Z0-9_-]+/]) (defaults to: 'input-file')
  • syslog_tag (Pattern[/[a-zA-Z0-9_-]+/]) (defaults to: $title)
  • priority (Integer) (defaults to: 10)
  • startmsg_regex (Optional[String]) (defaults to: undef)
  • addmetadata (Enum['on','off']) (defaults to: 'off')
  • addceetag (Enum['on','off']) (defaults to: 'off')


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'modules/rsyslog/manifests/input/file.pp', line 14

define rsyslog::input::file (
    String  $path,
    Wmflib::Ensure $ensure                       = present,
    Enum['on','off'] $reopen_on_truncate         = 'on',
    Pattern[/[a-zA-Z0-9_-]+/] $syslog_tag_prefix = 'input-file',
    Pattern[/[a-zA-Z0-9_-]+/] $syslog_tag        = $title,
    Integer $priority                            = 10,
    Optional[String] $startmsg_regex             = undef,
    Enum['on','off'] $addmetadata                = 'off',
    Enum['on','off'] $addceetag                  = 'off',
) {
    rsyslog::conf { "${syslog_tag_prefix}-${title}":
        ensure   => $ensure,
        content  => template('rsyslog/input/file.erb'),
        priority => $priority,
        require  => Rsyslog::Conf['imfile'],
    }

    if $ensure == 'present' and !defined(Rsyslog::Conf['imfile']) {
        rsyslog::conf { 'imfile':
            content  => 'module(load="imfile")',
            priority => 00,
        }
    }
}