Defined Type: rsyslog::input::file

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

Overview

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


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

define rsyslog::input::file(
    String  $path,
    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}-${syslog_tag}":
        content  => template('rsyslog/input/file.erb'),
        priority => $priority,
        require  => Rsyslog::Conf['imfile'],
    }

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

}