Defined Type: splunk::input

Defined in:
manifests/input.pp

Overview

splunk::input()

create a network or file monitor input snippet to be concatenated into $SPLUNK_HOME/etc/system/local/inputs.conf if creating a file monitor, apply acl to the object as well

Parameters:

  • disabled (Boolean) (defaults to: false)
  • inputtype (String) (defaults to: 'monitor')
  • sourcetype (String) (defaults to: 'auto')
  • index (String) (defaults to: 'default')
  • cache (Boolean) (defaults to: true)
  • size (Integer) (defaults to: 1)
  • recurse (Boolean) (defaults to: false)
  • target (Optional[String]) (defaults to: undef)
  • dir (Optional[String]) (defaults to: $splunk::dir)
  • user (Optional[String]) (defaults to: $splunk::user)
  • group (Optional[String]) (defaults to: $splunk::group)
  • options (Optional[Array]) (defaults to: undef)
  • content (Optional[String]) (defaults to: undef)


7
8
9
10
11
12
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'manifests/input.pp', line 7

define splunk::input (
  Boolean $disabled  = false,
  String $inputtype  = 'monitor',
  String $sourcetype = 'auto',
  String $index      = 'default',
  Boolean $cache     = true,
  Integer $size      = 1,
  Boolean $recurse   = false,
  Optional[String] $target     = undef,
  Optional[String] $dir        = $splunk::dir,
  Optional[String] $user       = $splunk::user,
  Optional[String] $group      = $splunk::group,
  Optional[Array] $options     = undef,
  Optional[String] $content    = undef
) {
  $local    = "${dir}/etc/system/local"

  # Validate parameters
  #
  if $target == undef {
    $target = $title
  }

  if $content == undef {
    $body = template("${module_name}/inputs.d/input.erb")
    if $inputtype == 'monitor' {
      splunk::acl { $title:
        target  => $target,
        group   => $group,
        recurse => $recurse,
      }
    }
  } else {
    $body = $content
  }

  file { "${local}/inputs.d/${title}":
    owner   => $user,
    group   => $group,
    mode    => '0440',
    content => $body,
    require => File["${local}/inputs.d"],
    notify  => Exec['update-inputs'],
  }
}