2015-12-04 10:03:52 +00:00
|
|
|
# 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',
|
2015-12-04 10:03:52 +00:00
|
|
|
# 'tag' => 'application.test'
|
|
|
|
# }
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# Copyright
|
|
|
|
# ---------
|
|
|
|
#
|
|
|
|
# Copyright 2015 wywy GmbH, unless otherwise noted.
|
2015-12-01 13:18:06 +00:00
|
|
|
#
|
|
|
|
define fluentd::source (
|
|
|
|
$ensure = present,
|
|
|
|
$priority = 10,
|
|
|
|
$config = {},
|
|
|
|
) {
|
2015-12-01 14:11:24 +00:00
|
|
|
|
|
|
|
# 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'),
|
|
|
|
}
|
|
|
|
}
|