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
|
# File 'manifests/config.pp', line 8
class filebeats::config (
Array $elasticsearch_hosts,
String $elasticsearch_index,
String $elasticsearch_password,
String $elasticsearch_protocol,
String $elasticsearch_ssl_certificate,
Array $elasticsearch_ssl_certificate_authorities,
String $elasticsearch_ssl_certificate_key,
Boolean $elasticsearch_template_enabled,
String $elasticsearch_template_name,
Boolean $elasticsearch_template_overwrite,
String $elasticsearch_template_path,
String $elasticsearch_username,
Array $export_log_paths,
Hash $log_settings,
Array $logstash_hosts,
Integer $logstash_bulk_max_size,
String $logstash_index,
Boolean $logstash_loadbalance,
Integer $logstash_worker,
String $logstash_ssl_certificate,
Array $logstash_ssl_certificate_authorities,
String $logstash_ssl_certificate_key,
String $logstash_ttl,
Array $prospectors,
){
$config_path = $filebeats::params::config_path
if empty($log_settings) {
$logging = {}
} else {
$logging = merge($::filebeats::params::log_settings, $log_settings)
}
if !empty($logstash_ttl) {
if $logstash_ttl !~ /^\-?[0-9]+\.?[0-9]*(?:ns|us|ms|s|m|h)$/ {
fail("Parameter \$logstash_ttl with content '${logstash_ttl}': is not a valid elastic duration")
}
}
if empty($prospectors) {
validate_array($export_log_paths)
$prospectors_array = [{'paths' => $export_log_paths,
'input_type' => 'log',
'doc_type' => 'log'
}]
} else {
$prospectors_array = $prospectors
}
file {"${config_path}/filebeat.yml":
ensure => present,
owner => root,
group => root,
mode => '0640',
content => template('filebeats/filebeat.yml.erb'),
require => Package['filebeat'],
notify => Service['filebeat'],
}
}
|