mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-09-13 08:59:29 +00:00
Compare commits
11 Commits
0.6.0
...
source_par
Author | SHA1 | Date | |
---|---|---|---|
|
29122932ef | ||
|
72e6bcd744 | ||
|
3c537f0ff5 | ||
|
1077f6d5dd | ||
|
90a16243a6 | ||
|
dec8216a78 | ||
|
948431f50c | ||
|
d1d22c8874 | ||
|
0023cc7902 | ||
|
9eea9f2009 | ||
|
344453c241 |
@@ -6,8 +6,6 @@ script: bundle exec rake validate && bundle exec rake lint && bundle exec rake s
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- rvm: 2.1.10
|
||||
env: PUPPET_VERSION="~> 3.0"
|
||||
- rvm: 2.1.10
|
||||
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
|
||||
- rvm: 2.2.7
|
||||
|
@@ -1,4 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
## 1.0.0
|
||||
|
||||
**Breaking changes:** This version drops puppet 3 support!
|
||||
|
||||
* Fix hard coded user/group names in config manifest (#23)
|
||||
* migrate from stdlib validation to puppet datatypes (#24)
|
||||
|
||||
## 0.6.0
|
||||
* Updated README
|
||||
* fixed broken links, due to github organisation rename
|
||||
|
6
Gemfile
6
Gemfile
@@ -1,6 +1,6 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.0' : puppetversion = ENV['PUPPET_VERSION'].to_s
|
||||
ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 4.6' : puppetversion = ENV['PUPPET_VERSION'].to_s
|
||||
gem 'puppet', puppetversion
|
||||
gem 'puppetlabs_spec_helper', '>= 0.8.2'
|
||||
gem 'puppet-lint', '>= 1.0.0'
|
||||
@@ -17,6 +17,6 @@ gem 'beaker-rspec', beakerrspec
|
||||
|
||||
platforms :ruby_19 do
|
||||
gem 'public_suffix', '< 1.5.0', :platforms => :ruby_19
|
||||
gem 'nokogiri', '< 1.7.0', :platforms => :ruby_19
|
||||
gem 'nokogiri', '~> 1.8.1', :platforms => :ruby_19
|
||||
gem 'mime-types', '< 3.0', :platforms => :ruby_19
|
||||
end
|
||||
end
|
||||
|
24
README.md
24
README.md
@@ -131,6 +131,14 @@ include '::fluentd'
|
||||
'type' => 'tail',
|
||||
'format' => 'json',
|
||||
'path' => '/var/log/test-application/*.json',
|
||||
'parse' => {
|
||||
'type' => 'regexp',
|
||||
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
|
||||
},
|
||||
'storage'=> {
|
||||
'type' => 'local',
|
||||
'path' => 'test.pos'
|
||||
},
|
||||
'tag' => 'application.test'
|
||||
}
|
||||
}
|
||||
@@ -142,6 +150,14 @@ include '::fluentd'
|
||||
type tail
|
||||
format json
|
||||
path /var/log/test-application/*.json
|
||||
<parse>
|
||||
type regexp
|
||||
expression ^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$
|
||||
</parse>
|
||||
<storage>
|
||||
type local
|
||||
path test.pos
|
||||
</storage>
|
||||
tag application.test
|
||||
</source>
|
||||
```
|
||||
@@ -263,14 +279,14 @@ This module gives you the possibility to install plugins as gem or files.
|
||||
### Requirements
|
||||
|
||||
Modules:
|
||||
* puppetlabs/apt >= 1.8.0 < 3.0.0
|
||||
* puppetlabs/apt >= 4.0.0
|
||||
|
||||
## Limitations
|
||||
This module has been built on and tested against Puppet 3.7.5 and higher.
|
||||
This module has been built on and tested against Puppet 4.6 and higher.
|
||||
|
||||
The module has been tested on:
|
||||
|
||||
* Ubuntu 12.04
|
||||
* Ubuntu 16.04
|
||||
|
||||
Testing on other platforms has been light and cannot be guaranteed.
|
||||
|
||||
@@ -285,8 +301,8 @@ To run the tests install the ruby dependencies with `bundler` and execute
|
||||
bundle install --path vendor/bundle
|
||||
bundle exec rake spec
|
||||
bundle exec rake lint
|
||||
bundle exec rake beaker BEAKER_set=ubuntu-server-1204-x64
|
||||
bundle exec rake beaker BEAKER_set=ubuntu-server-1404-x64
|
||||
bundle exec rake beaker BEAKER_set=ubuntu-server-1604-x64
|
||||
bundle exec rake beaker BEAKER_set=debian-60-x64
|
||||
bundle exec rake beaker BEAKER_set=debian-78-x64
|
||||
bundle exec rake beaker BEAKER_set=debian-82-x64
|
||||
|
@@ -2,9 +2,17 @@
|
||||
::fluentd::source { 'test':
|
||||
priority => 10,
|
||||
config => {
|
||||
'type' => 'tail',
|
||||
'format' => 'json',
|
||||
'path' => '/var/log/test-application/*.json',
|
||||
'tag' => 'application.test'
|
||||
'type' => 'tail',
|
||||
'format' => 'json',
|
||||
'path' => '/var/log/test-application/*.json',
|
||||
'parse' => {
|
||||
'type' => 'regexp',
|
||||
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
|
||||
},
|
||||
'storage' => {
|
||||
'type' => 'local',
|
||||
'path' => 'test.pos'
|
||||
},
|
||||
'tag' => 'application.test'
|
||||
}
|
||||
}
|
||||
|
@@ -28,8 +28,8 @@ define fluentd::config::file (
|
||||
file { $config_path:
|
||||
ensure => $ensure,
|
||||
content => $content,
|
||||
owner => 'td-agent',
|
||||
group => 'td-agent',
|
||||
owner => $::fluentd::user_name,
|
||||
group => $::fluentd::user_group,
|
||||
mode => '0644',
|
||||
notify => Class['Fluentd::Service'],
|
||||
}
|
||||
|
@@ -38,23 +38,16 @@
|
||||
# Copyright 2015 wywy, unless otherwise noted.
|
||||
#
|
||||
define fluentd::filter (
|
||||
$ensure = present,
|
||||
$priority = 20,
|
||||
$pattern = '**',
|
||||
$config = {},
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
Integer $priority = 20,
|
||||
String $pattern = '**',
|
||||
Hash $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)
|
||||
|
||||
fluentd::config::file { "filter-${title}":
|
||||
ensure => $ensure,
|
||||
priority => $priority,
|
||||
content => template( 'fluentd/filter.erb'),
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -65,37 +65,24 @@
|
||||
# Copyright 2015 wywy, unless otherwise noted.
|
||||
#
|
||||
class fluentd (
|
||||
$repo_manage = $::fluentd::params::repo_manage,
|
||||
$package_ensure = $::fluentd::params::package_ensure,
|
||||
$package_name = $::fluentd::params::package_name,
|
||||
$package_install_options = $::fluentd::params::package_install_options,
|
||||
$service_manage = $::fluentd::params::service_manage,
|
||||
$service_name = $::fluentd::params::service_name,
|
||||
$service_ensure = $::fluentd::params::service_ensure,
|
||||
$service_enable = $::fluentd::params::service_enable,
|
||||
$config_path = $::fluentd::params::config_path,
|
||||
$conf_dir = $::fluentd::params::conf_dir,
|
||||
$config_file = $::fluentd::params::config_file,
|
||||
$conf_dir_manage = $::fluentd::params::conf_dir_manage,
|
||||
$user_manage = $::fluentd::params::user_manage,
|
||||
$user_name = $::fluentd::params::user_name,
|
||||
$user_group = $::fluentd::params::user_group,
|
||||
$user_groups = $::fluentd::params::user_groups,
|
||||
Boolean $repo_manage = $::fluentd::params::repo_manage,
|
||||
String $package_ensure = $::fluentd::params::package_ensure,
|
||||
String $package_name = $::fluentd::params::package_name,
|
||||
Array $package_install_options = $::fluentd::params::package_install_options,
|
||||
Boolean $service_manage = $::fluentd::params::service_manage,
|
||||
String $service_name = $::fluentd::params::service_name,
|
||||
Enum['running', 'stopped'] $service_ensure = $::fluentd::params::service_ensure,
|
||||
Boolean $service_enable = $::fluentd::params::service_enable,
|
||||
String $config_path = $::fluentd::params::config_path,
|
||||
String $conf_dir = $::fluentd::params::conf_dir,
|
||||
String $config_file = $::fluentd::params::config_file,
|
||||
Boolean $conf_dir_manage = $::fluentd::params::conf_dir_manage,
|
||||
Boolean $user_manage = $::fluentd::params::user_manage,
|
||||
String $user_name = $::fluentd::params::user_name,
|
||||
String $user_group = $::fluentd::params::user_group,
|
||||
Array $user_groups = $::fluentd::params::user_groups,
|
||||
) inherits fluentd::params {
|
||||
|
||||
# parameter validation
|
||||
validate_bool($repo_manage)
|
||||
validate_string($package_ensure)
|
||||
validate_string($package_name)
|
||||
validate_array($package_install_options)
|
||||
validate_bool($service_manage)
|
||||
validate_string($service_name)
|
||||
validate_bool($service_enable)
|
||||
|
||||
if ! ($service_ensure in [ 'running', 'stopped' ]) {
|
||||
fail('service_ensure parameter must be running or stopped')
|
||||
}
|
||||
|
||||
# class calls
|
||||
include '::fluentd::repo'
|
||||
include '::fluentd::install'
|
||||
|
@@ -43,23 +43,16 @@
|
||||
# Copyright 2015 wywy, unless otherwise noted.
|
||||
#
|
||||
define fluentd::match (
|
||||
$ensure = present,
|
||||
$priority = 30,
|
||||
$pattern = '**',
|
||||
$config = {},
|
||||
Enum['present', 'absent'] $ensure = present,
|
||||
Integer $priority = 30,
|
||||
String $pattern = '**',
|
||||
Hash $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)
|
||||
|
||||
fluentd::config::file { "match-${title}":
|
||||
ensure => $ensure,
|
||||
priority => $priority,
|
||||
content => template( 'fluentd/match.erb'),
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -26,9 +26,9 @@
|
||||
# Copyright 2015 wywy, unless otherwise noted.
|
||||
#
|
||||
define fluentd::plugin (
|
||||
$ensure = present,
|
||||
$type = 'gem',
|
||||
$source = undef,
|
||||
String $ensure = present,
|
||||
String $type = 'gem',
|
||||
Optional[String] $source = undef,
|
||||
) {
|
||||
|
||||
case $type {
|
||||
@@ -43,7 +43,6 @@ define fluentd::plugin (
|
||||
if ! ($ensure in [ 'present', 'absent' ]) {
|
||||
fail('ensure parameter must be present or absent')
|
||||
}
|
||||
validate_string($source)
|
||||
|
||||
fluentd::plugin::file { $name:
|
||||
ensure => $ensure,
|
||||
|
@@ -34,17 +34,15 @@
|
||||
# Copyright 2015 wywy, unless otherwise noted.
|
||||
#
|
||||
define fluentd::source (
|
||||
$ensure = present,
|
||||
$priority = 10,
|
||||
$config = {},
|
||||
String $ensure = present,
|
||||
Integer $priority = 10,
|
||||
Hash $config = {},
|
||||
) {
|
||||
|
||||
# parameter validation
|
||||
if ! ($ensure in [ 'present', 'absent' ]) {
|
||||
fail('ensure parameter must be present or absent')
|
||||
}
|
||||
validate_integer($priority)
|
||||
validate_hash($config)
|
||||
|
||||
fluentd::config::file { "source-${title}":
|
||||
ensure => $ensure,
|
||||
|
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"name": "wywygmbh-fluentd",
|
||||
"version": "0.6.0",
|
||||
"name": "wycore-fluentd",
|
||||
"version": "1.0.0",
|
||||
"author": "wywy",
|
||||
"summary": "Generic module for fluentd (td-agent).",
|
||||
"license": "Apache-2.0",
|
||||
"source": "https://github.com/wywy/puppet-fluentd",
|
||||
"project_page": "https://github.com/wywy/puppet-fluentd",
|
||||
"issues_url": "https://github.com/wywy/puppet-fluentd/issues",
|
||||
"source": "https://github.com/wycore/puppet-fluentd",
|
||||
"project_page": "https://github.com/wycore/puppet-fluentd",
|
||||
"issues_url": "https://github.com/wycore/puppet-fluentd/issues",
|
||||
"tags": ["fluentd", "td-agent"],
|
||||
"operatingsystem_support": [
|
||||
{
|
||||
"operatingsystem": "Ubuntu",
|
||||
"operatingsystemrelease": [ "14.04", "12.04" ]
|
||||
"operatingsystemrelease": [ "16.04", "14.04" ]
|
||||
},
|
||||
{
|
||||
"operatingsystem": "Debian",
|
||||
@@ -24,7 +24,7 @@
|
||||
],
|
||||
"dependencies": [
|
||||
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" },
|
||||
{ "name": "puppetlabs/apt", "version_requirement": ">= 2.0.0 < 3.0.0" }
|
||||
{ "name": "puppetlabs/apt", "version_requirement": ">= 4.0.0" }
|
||||
],
|
||||
"data_provider": null
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ describe 'fluentd::filter' do
|
||||
let(:title) { 'test' }
|
||||
let(:params) do
|
||||
{
|
||||
priority: '20',
|
||||
priority: 20,
|
||||
pattern: '*.test',
|
||||
config: {
|
||||
'type' => 'record_transformer',
|
||||
|
@@ -13,7 +13,7 @@ describe 'fluentd::match' do
|
||||
let(:title) { 'test' }
|
||||
let(:params) do
|
||||
{
|
||||
priority: '30',
|
||||
priority: 30,
|
||||
pattern: '*.test',
|
||||
config: {
|
||||
'flush_interval' => '30s',
|
||||
@@ -41,7 +41,7 @@ describe 'fluentd::match' do
|
||||
let(:title) { 'test' }
|
||||
let(:params) do
|
||||
{
|
||||
priority: '30',
|
||||
priority: 30,
|
||||
pattern: '*.test',
|
||||
config: {
|
||||
'type' => 'copy',
|
||||
|
@@ -13,11 +13,19 @@ describe 'fluentd::source' do
|
||||
let(:title) { 'test' }
|
||||
let(:params) do
|
||||
{
|
||||
priority: '10',
|
||||
priority: 10,
|
||||
config: {
|
||||
'type' => 'tail',
|
||||
'format' => 'json',
|
||||
'path' => '/var/log/test-application/*.json',
|
||||
'parse' => {
|
||||
'type' => 'regexp',
|
||||
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
|
||||
},
|
||||
'storage'=> {
|
||||
'type' => 'local',
|
||||
'path' => 'test.pos'
|
||||
},
|
||||
'tag' => 'application.test'
|
||||
}
|
||||
}
|
||||
|
8
spec/fixtures/files/source_tail.conf
vendored
8
spec/fixtures/files/source_tail.conf
vendored
@@ -2,5 +2,13 @@
|
||||
type tail
|
||||
format json
|
||||
path /var/log/test-application/*.json
|
||||
<parse>
|
||||
type regexp
|
||||
expression ^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$
|
||||
</parse>
|
||||
<storage>
|
||||
type local
|
||||
path test.pos
|
||||
</storage>
|
||||
tag application.test
|
||||
</source>
|
||||
|
@@ -1,5 +1,13 @@
|
||||
<source>
|
||||
<% @config.each do |key, val| -%>
|
||||
<%- if val.is_a?( Hash ) -%>
|
||||
<<%= key -%>>
|
||||
<%- val.each do |key2, val2| -%>
|
||||
<%= key2 -%> <%= val2 %>
|
||||
<%- end -%>
|
||||
</<%= key %>>
|
||||
<%- else -%>
|
||||
<%= key -%> <%= val %>
|
||||
<%- end -%>
|
||||
<% end -%>
|
||||
</source>
|
||||
|
Reference in New Issue
Block a user