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

55 lines
1.1 KiB
ObjectPascal
Raw Permalink Normal View History

# Define: fluentd::source
# ===========================
#
# Configures a 'source' config file.
#
# Parameters
# ----------
# [*ensure*]
# Default: 'present'
# [*priority*]
# Defines the priority
# Default: '10'
# [*config*]
# Configuration, which must be a hash
# Default: {}'
#
# Examples
# --------
#
# @example
# ::fluentd::source { 'test':
# priority => 10,
# config => {
2015-12-04 11:54:07 +00:00
# 'type' => 'tail',
# 'format' => 'json',
# 'path' => '/var/log/test-application/*.json',
# 'tag' => 'application.test'
# }
# }
#
# Copyright
# ---------
#
2017-08-10 12:24:22 +00:00
# Copyright 2015 wywy, unless otherwise noted.
2015-12-01 13:18:06 +00:00
#
define fluentd::source (
$ensure = present,
$priority = 10,
$config = {},
) {
# parameter validation
if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent')
}
validate_integer($priority)
validate_hash($config)
2015-12-01 13:18:06 +00:00
fluentd::config::file { "source-${title}":
ensure => $ensure,
priority => $priority,
content => template( 'fluentd/source.erb'),
}
}