Puppet Class: beats::config::filebeat

Defined in:
manifests/config/filebeat.pp

Summary

Configuration of filebeat

Overview

Parameters:

  • enable_input_log (Boolean)
  • enable_input_filestream (Boolean)
  • paths_input_log (Array[String])
  • paths_input_filestream (Array[String])
  • output_elasticsearch (Optional[Hash[String, Any]])
  • output_logstash (Optional[Hash[String, Any]])
  • processors (Array[Hash[String, Any]])
  • override_input_log (Hash[String, Any]) (defaults to: {})
  • override_input_filestream (Hash[String, Any]) (defaults to: {})
  • override_config_setup (Hash[String, Any]) (defaults to: {})
  • override (Hash[String, Any]) (defaults to: {})


2
3
4
5
6
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
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
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
# File 'manifests/config/filebeat.pp', line 2

class beats::config::filebeat (
  Boolean                     $enable_input_log,
  Boolean                     $enable_input_filestream,
  Array[String]               $paths_input_log,
  Array[String]               $paths_input_filestream,
  Optional[Hash[String, Any]] $output_elasticsearch,
  Optional[Hash[String, Any]] $output_logstash,
  Array[Hash[String, Any]]    $processors,
  Hash[String, Any]           $override_input_log        = {},
  Hash[String, Any]           $override_input_filestream = {},
  Hash[String, Any]           $override_config_setup     = {},
  Hash[String, Any]           $override                  = {},
) {
  assert_private("Use of private class ${name} by ${caller_module_name}")

  require beats::modules::filebeat::apache
  require beats::modules::filebeat::auditd
  require beats::modules::filebeat::elasticsearch
  require beats::modules::filebeat::haproxy
  require beats::modules::filebeat::iptables
  require beats::modules::filebeat::kibana
  require beats::modules::filebeat::mysql
  require beats::modules::filebeat::nginx
  require beats::modules::filebeat::postgresql
  require beats::modules::filebeat::system

  $config_input_log = deep_merge({
      'type'    => 'log',
      'enabled' => $enable_input_log,
      'paths'   => $paths_input_log,
      # "exclude_lines" => ['^DBG'],
      # "include_lines" => ['^ERR', '^WARN'],
      # "exclude_files" => ['.gz$'],
      # "fields" => {
      #   "level" => "debug",
      #   "review" => 1,
      # },
      # "multiline" => {
      #   "pattern" => "^\[",
      #   "negate" => false,
      #   "match" => "after",
      # },
  }, $override_input_log)

  $config_input_filestream = deep_merge({
      'type'    => 'filestream',
      'enabled' => $enable_input_filestream,
      'paths'   => $paths_input_filestream,
      # "exclude_lines" => ['^DBG'],
      # "include_lines" => ['^ERR', '^WARN'],
      # "prospector" => {
      #   "scanner" => {
      #     "exclude_files" => ['.gz$'],
      #   },
      # },
      # "fields" => {
      #   "level" => "debug",
      #   "review" => 1,
      # },
  }, $override_input_filestream)

  $config_setup = deep_merge({
      'template'   => {
        'settings' => {
          'index' => {
            'number_of_shards' => 1,
            # "codec" => "best_compression",
          },
          # "_source" => {
          #   "enabled" => false,
          # },
        },
      },
      'dashboards' => {
        # "enabled" => false,
        # "url" => undef,
      },
      'kibana'     => {
        # "host" => "localhost:5601",
        # "space" => {
        #   "id" => undef,
        # },
      },
  }, $override_config_setup)

  if $output_elasticsearch and $output_logstash {
    fail('Only one output must be configured, please choose between logstach and elasticsearch')
  } elsif $output_elasticsearch {
    $output = {
      'elasticsearch' => $output_elasticsearch,
    }
  } elsif $output_logstash {
    $output = {
      'logstash' => $output_logstash,
    }
  } else {
    fail('No output was set, please set one output between logstach and elasticsearch')
  }

  $final = deep_merge({
      'filebeat'   => {
        'inputs'  => [
          $config_input_log,
          $config_input_filestream,
        ],
        'modules' => [
          $beats::modules::filebeat::apache::final,
          $beats::modules::filebeat::auditd::final,
          $beats::modules::filebeat::elasticsearch::final,
          $beats::modules::filebeat::haproxy::final,
          $beats::modules::filebeat::iptables::final,
          $beats::modules::filebeat::kibana::final,
          $beats::modules::filebeat::mysql::final,
          $beats::modules::filebeat::nginx::final,
          $beats::modules::filebeat::postgresql::final,
          $beats::modules::filebeat::system::final,
        ],
      },
      'setup'      => $config_setup,
      'name'       => $facts['networking']['hostname'],
      # "tags" => ["service-X", "web-tier"],
      # "fields" => {
      #   "env" => "staging",
      # },
      # "cloud" => {
      #   "id" => undef,
      #   "auth" => undef,
      # },
      'output'     => $output,
      'processors' => $processors,
      # "logging" => {
      #   "level" => "debug",
      #   "selectors" => ["*"],
      # },
      # "monitoring" => {
      #   "enabled" => false,
      #   "cluster_uuid" => undef,
      #   "elasticsearch" => undef,
      # },
      # "instrumentation" => {
      #   "enabled" => false,
      #   "environment" => "",
      #   "hosts" => ["http://localhost:8200"],
      #   "api_key" => undef,
      #   "secret_token" => undef,
      # }
      # "migration" => { "6_to_7" => { "enabled" => true } }
  }, $override)
}