2015-12-04 10:03:52 +00:00
|
|
|
# Define: fluentd::match
|
|
|
|
# ===========================
|
|
|
|
#
|
|
|
|
# Configures a 'match' config file.
|
|
|
|
#
|
|
|
|
# Parameters
|
|
|
|
# ----------
|
|
|
|
# [*ensure*]
|
|
|
|
# Default: 'present'
|
|
|
|
# [*priority*]
|
|
|
|
# Defines the priority
|
|
|
|
# Default: '30'
|
|
|
|
# [*pattern*]
|
|
|
|
# Defines matching the pattern
|
|
|
|
# Default: '**'
|
|
|
|
# [*config*]
|
|
|
|
# Configuration, which must be a hash
|
|
|
|
# Default: {}'
|
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
# --------
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# ::fluentd::match { 'test':
|
|
|
|
# priority => 30,
|
|
|
|
# pattern => '*.test'
|
|
|
|
# config => {
|
2015-12-04 11:54:07 +00:00
|
|
|
# 'flush_interval' => '30s',
|
|
|
|
# 'type' => 'secure_forward',
|
|
|
|
# 'secure' => 'yes',
|
|
|
|
# 'shared_key' => 'my_shared_key',
|
|
|
|
# 'self_hostname' => 'instance.test.com',
|
|
|
|
# 'ca_cert_path' => '/path/to/ca.cert',
|
2015-12-11 09:21:27 +00:00
|
|
|
# 'server' => [{
|
2015-12-04 10:03:52 +00:00
|
|
|
# 'host' => 'test.server.com'
|
2015-12-11 09:21:27 +00:00
|
|
|
# }]
|
2015-12-04 10:03:52 +00:00
|
|
|
# }
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# Copyright
|
|
|
|
# ---------
|
|
|
|
#
|
2017-08-10 12:24:22 +00:00
|
|
|
# Copyright 2015 wywy, unless otherwise noted.
|
2015-12-01 13:19:18 +00:00
|
|
|
#
|
|
|
|
define fluentd::match (
|
|
|
|
$ensure = present,
|
|
|
|
$priority = 30,
|
2015-12-04 10:03:52 +00:00
|
|
|
$pattern = '**',
|
2015-12-01 13:19:18 +00:00
|
|
|
$config = {},
|
|
|
|
) {
|
2015-12-01 14:11:19 +00:00
|
|
|
|
|
|
|
# parameter validation
|
|
|
|
if ! ($ensure in [ 'present', 'absent' ]) {
|
|
|
|
fail('ensure parameter must be present or absent')
|
|
|
|
}
|
|
|
|
validate_integer($priority)
|
|
|
|
validate_string($pattern)
|
|
|
|
validate_hash($config)
|
|
|
|
|
2015-12-01 13:19:18 +00:00
|
|
|
fluentd::config::file { "match-${title}":
|
|
|
|
ensure => $ensure,
|
|
|
|
priority => $priority,
|
|
|
|
content => template( 'fluentd/match.erb'),
|
|
|
|
}
|
|
|
|
}
|