2015-12-04 10:03:52 +00:00
|
|
|
# Define: fluentd::filter
|
|
|
|
# ===========================
|
|
|
|
#
|
|
|
|
# Configures a 'filter' config file.
|
|
|
|
#
|
|
|
|
# Parameters
|
|
|
|
# ----------
|
|
|
|
# [*ensure*]
|
|
|
|
# Default: 'present'
|
|
|
|
# [*priority*]
|
|
|
|
# Defines the priority
|
|
|
|
# Default: '20'
|
|
|
|
# [*pattern*]
|
|
|
|
# Defines matching the pattern
|
|
|
|
# Default: '**'
|
|
|
|
# [*config*]
|
|
|
|
# Configuration, which must be a hash
|
|
|
|
# Default: {}'
|
|
|
|
#
|
|
|
|
# Examples
|
|
|
|
# --------
|
|
|
|
#
|
|
|
|
# @example
|
|
|
|
# ::fluentd::filter { 'test':
|
|
|
|
# priority => 20,
|
2015-12-04 11:54:07 +00:00
|
|
|
# pattern => '*.test',
|
2015-12-04 10:03:52 +00:00
|
|
|
# config => {
|
2015-12-04 11:54:07 +00:00
|
|
|
# 'type' => 'record_transformer',
|
2015-12-04 10:03:52 +00:00
|
|
|
# 'record' => {
|
|
|
|
# 'hostname' => '${hostname}'
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# Copyright
|
|
|
|
# ---------
|
|
|
|
#
|
|
|
|
# Copyright 2015 wywy GmbH, unless otherwise noted.
|
2015-12-01 13:18:37 +00:00
|
|
|
#
|
|
|
|
define fluentd::filter (
|
|
|
|
$ensure = present,
|
|
|
|
$priority = 20,
|
2015-12-04 10:03:52 +00:00
|
|
|
$pattern = '**',
|
2015-12-01 13:18:37 +00:00
|
|
|
$config = {},
|
|
|
|
) {
|
2015-12-01 14:11:05 +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:18:37 +00:00
|
|
|
fluentd::config::file { "filter-${title}":
|
|
|
|
ensure => $ensure,
|
|
|
|
priority => $priority,
|
|
|
|
content => template( 'fluentd/filter.erb'),
|
|
|
|
}
|
|
|
|
}
|