1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-11-10 04:50:34 +00:00
puppet-fluentd/manifests/filter.pp

61 lines
1.2 KiB
ObjectPascal
Raw Normal View History

# 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',
# config => {
2015-12-04 11:54:07 +00:00
# 'type' => 'record_transformer',
# '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,
$pattern = '**',
2015-12-01 13:18:37 +00:00
$config = {},
) {
# 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'),
}
}