Puppet Class: winlogbeat

Inherits:
winlogbeat::params
Defined in:
manifests/init.pp

Overview

Parameters:

  • major_version (Any) (defaults to: undef)
  • package_ensure (Any) (defaults to: $winlogbeat::params::package_ensure)
  • service_ensure (Any) (defaults to: $winlogbeat::params::service_ensure)
  • service_enable (Any) (defaults to: $winlogbeat::params::service_enable)
  • service_provider (Any) (defaults to: $winlogbeat::params::service_provider)
  • registry_file (Any) (defaults to: $winlogbeat::params::registry_file)
  • config_file (Any) (defaults to: $winlogbeat::params::config_file)
  • outputs (Any) (defaults to: $winlogbeat::params::outputs)
  • shipper (Any) (defaults to: $winlogbeat::params::shipper)
  • logging (Any) (defaults to: $winlogbeat::params::logging)
  • run_options (Any) (defaults to: $winlogbeat::params::run_options)
  • conf_template (Any) (defaults to: undef)
  • download_url (Any) (defaults to: undef)
  • install_dir (Any) (defaults to: $winlogbeat::params::install_dir)
  • tmp_dir (Any) (defaults to: $winlogbeat::params::tmp_dir)
  • use_generic_template (Any) (defaults to: $winlogbeat::params::use_generic_template)
  • beat_name (Any) (defaults to: $winlogbeat::params::beat_name)
  • tags (Any) (defaults to: $winlogbeat::params::tags)
  • queue_size (Any) (defaults to: $winlogbeat::params::queue_size)
  • max_procs (Any) (defaults to: $winlogbeat::params::max_procs)
  • fields (Any) (defaults to: $winlogbeat::params::fields)
  • fields_under_root (Any) (defaults to: $winlogbeat::params::fields_under_root)
  • metrics (Any) (defaults to: undef)
  • event_logs (Any) (defaults to: {})
  • event_logs_merge (Any) (defaults to: false)
  • proxy_address (Any) (defaults to: undef)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'manifests/init.pp', line 29

class winlogbeat (
  $major_version        = undef,
  $package_ensure       = $winlogbeat::params::package_ensure,
  $service_ensure       = $winlogbeat::params::service_ensure,
  $service_enable       = $winlogbeat::params::service_enable,
  $service_provider     = $winlogbeat::params::service_provider,
  $registry_file        = $winlogbeat::params::registry_file,
  $config_file          = $winlogbeat::params::config_file,
  $outputs              = $winlogbeat::params::outputs,
  $shipper              = $winlogbeat::params::shipper,
  $logging              = $winlogbeat::params::logging,
  $run_options          = $winlogbeat::params::run_options,
  $conf_template        = undef,
  $download_url         = undef,
  $install_dir          = $winlogbeat::params::install_dir,
  $tmp_dir              = $winlogbeat::params::tmp_dir,
  #### v5 only ####
  $use_generic_template = $winlogbeat::params::use_generic_template,
  $beat_name            = $winlogbeat::params::beat_name,
  $tags                 = $winlogbeat::params::tags,
  $queue_size           = $winlogbeat::params::queue_size,
  $max_procs            = $winlogbeat::params::max_procs,
  $fields               = $winlogbeat::params::fields,
  $fields_under_root    = $winlogbeat::params::fields_under_root,
  $metrics              = undef,
  #### End v5 only ####
  $event_logs           = {},
  $event_logs_merge     = false,
  $proxy_address        = undef,
) inherits winlogbeat::params {

  validate_bool($event_logs_merge)

  if $major_version == undef and getvar('::winlogbeat_version') == undef {
    $real_version = '5'
  } elsif $major_version == undef and versioncmp($::winlogbeat_version, '5.0.0') >= 0 {
    $real_version = '5'
  } elsif $major_version == undef and versioncmp($::winlogbeat_version, '5.0.0') < 0 {
    $real_version = '1'
  } else {
    $real_version = $major_version
  }

  if $conf_template != undef {
    $real_conf_template = $conf_template
  } elsif $real_version == '1' {
    if versioncmp('1.9.1', $::rubyversion) > 0 {
      $real_conf_template = "${module_name}/winlogbeat1.yml.ruby18.erb"
    } else {
      $real_conf_template = "${module_name}/winlogbeat1.yml.erb"
    }
  } elsif $real_version == '5' {
    if $use_generic_template {
      $real_conf_template = "${module_name}/winlogbeat1.yml.erb"
    } else {
      $real_conf_template = "${module_name}/winlogbeat5.yml.erb"
    }
  }

  $real_download_url = $download_url ? {
    undef   => "https://artifacts.elastic.co/downloads/beats/winlogbeat/winlogbeat-${package_ensure}-windows-${winlogbeat::params::url_arch}.zip",
    default => $download_url,
  }

  if $event_logs_merge {
    $event_logs_final = hiera_hash('winlogbeat::event_logs', $event_logs)
  } else {
    $event_logs_final = $event_logs
  }

  if $config_file != $winlogbeat::params::config_file {
    warning('You\'ve specified a non-standard config_file location - winlogbeat may fail to start unless you\'re doing something to fix this')
  }

  validate_hash($outputs, $logging, $event_logs_final)
  validate_string($registry_file, $package_ensure)

  if(!empty($proxy_address)){
    validate_re($proxy_address, ['^(http(?:s)?\:\/\/[a-zA-Z0-9]+(?:(?:\.|\-)[a-zA-Z0-9]+)+(?:\:\d+)?(?:\/[\w\-]+)*(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$'], 'ERROR: You must enter a proxy url in a valid format i.e. http://proxy.net:3128')
  }

  anchor { 'winlogbeat::begin': } ->
  class { '::winlogbeat::install': } ->
  class { '::winlogbeat::config': } ->
  class { '::winlogbeat::service': } ->
  anchor { 'winlogbeat::end': }
}