1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2025-09-13 08:59:29 +00:00

14 Commits
0.6.0 ... 1.0.1

Author SHA1 Message Date
Andy Pritchard
540ef4e40d Update metadata.json 2018-03-05 10:52:15 +00:00
Andy Pritchard
d92ea1e849 Updated README.md 2018-03-05 10:50:03 +00:00
Andy Pritchard
59fb7919a2 Merge pull request #1 from pilchkinstein-gtv/source_parse_storage
Implemented <parse>, <storage> etc sections within fluentd::source template
2018-03-05 09:13:34 +00:00
pilchkinstein-gtv
29122932ef Fixed lint warnings 2018-03-02 23:22:13 +00:00
pilchkinstein-gtv
72e6bcd744 Implemented <parse>, <storage> etc sections within fluentd::source template
- Changed templates/source.erb to accept Hash elements within 'config'
- Updated source_spec test
- Updated README.md
2018-03-02 22:32:51 +00:00
Christian Becker
3c537f0ff5 bump version in changelog 2018-01-17 12:13:37 +01:00
Christian Becker
1077f6d5dd drop puppet 3 support from the tests 2018-01-17 12:05:05 +01:00
Christian Becker
90a16243a6 whoops i broke the tests 2018-01-17 11:22:32 +01:00
Christian Becker
dec8216a78 bump versions
- breaking change, so we bump the major version
- update dependency versions to keep them relatively fresh
- update repo urls
2018-01-17 11:04:19 +01:00
Christian Becker
948431f50c Merge pull request #23 from tinkerborg/master
Fix hard coded user/group names in config manifest
2018-01-16 18:46:05 +01:00
Christian Becker
d1d22c8874 Update Gemfile
bump nokogiri to remove github vulnerability message
2018-01-16 18:39:21 +01:00
Christian Becker
0023cc7902 Merge pull request #24 from wycore/puppet4
migrate from stdlib validation to puppet datatypes
2018-01-16 18:36:46 +01:00
Christian Becker
9eea9f2009 migrate from stdlib validation to puppet datatypes
fixes some puppet 4 deprecation warnings caused by stdlib
2018-01-16 16:23:03 +01:00
tinkerborg
344453c241 Fix hard coded user/group names in config manifest 2018-01-12 15:27:53 -05:00
17 changed files with 115 additions and 91 deletions

View File

@@ -6,8 +6,6 @@ script: bundle exec rake validate && bundle exec rake lint && bundle exec rake s
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- rvm: 2.1.10
env: PUPPET_VERSION="~> 3.0"
- rvm: 2.1.10 - rvm: 2.1.10
env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes"
- rvm: 2.2.7 - rvm: 2.2.7

View File

@@ -1,4 +1,12 @@
# Changelog # 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 ## 0.6.0
* Updated README * Updated README
* fixed broken links, due to github organisation rename * fixed broken links, due to github organisation rename

View File

@@ -1,6 +1,6 @@
source 'https://rubygems.org' 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 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.8.2' gem 'puppetlabs_spec_helper', '>= 0.8.2'
gem 'puppet-lint', '>= 1.0.0' gem 'puppet-lint', '>= 1.0.0'
@@ -17,6 +17,6 @@ gem 'beaker-rspec', beakerrspec
platforms :ruby_19 do platforms :ruby_19 do
gem 'public_suffix', '< 1.5.0', :platforms => :ruby_19 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 gem 'mime-types', '< 3.0', :platforms => :ruby_19
end end

View File

@@ -1,6 +1,6 @@
# wywy/fluentd Puppet Module # pilchkinstein-gtv/fluentd Puppet Module
[![GitHub version](https://badge.fury.io/gh/wywy%2Fpuppet-fluentd.svg)](https://github.com/wywy/puppet-fluentd) [![GitHub version](https://badge.fury.io/gh/wywy%2Fpuppet-fluentd.svg)](https://github.com/pilchkinstein-gtv/puppet-fluentd)
[![Build Status](https://travis-ci.org/wywy/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywy/puppet-fluentd) [![Build Status](https://travis-ci.org/wywy/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywy/puppet-fluentd)
@@ -131,6 +131,14 @@ include '::fluentd'
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage'=> {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test' 'tag' => 'application.test'
} }
} }
@@ -142,6 +150,14 @@ include '::fluentd'
type tail type tail
format json format json
path /var/log/test-application/*.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 tag application.test
</source> </source>
``` ```
@@ -263,14 +279,14 @@ This module gives you the possibility to install plugins as gem or files.
### Requirements ### Requirements
Modules: Modules:
* puppetlabs/apt >= 1.8.0 < 3.0.0 * puppetlabs/apt >= 4.0.0
## Limitations ## 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: The module has been tested on:
* Ubuntu 12.04 * Ubuntu 16.04
Testing on other platforms has been light and cannot be guaranteed. 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 install --path vendor/bundle
bundle exec rake spec bundle exec rake spec
bundle exec rake lint 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-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-60-x64
bundle exec rake beaker BEAKER_set=debian-78-x64 bundle exec rake beaker BEAKER_set=debian-78-x64
bundle exec rake beaker BEAKER_set=debian-82-x64 bundle exec rake beaker BEAKER_set=debian-82-x64

View File

@@ -2,9 +2,17 @@
::fluentd::source { 'test': ::fluentd::source { 'test':
priority => 10, priority => 10,
config => { config => {
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'tag' => 'application.test' 'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage' => {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test'
} }
} }

View File

@@ -28,8 +28,8 @@ define fluentd::config::file (
file { $config_path: file { $config_path:
ensure => $ensure, ensure => $ensure,
content => $content, content => $content,
owner => 'td-agent', owner => $::fluentd::user_name,
group => 'td-agent', group => $::fluentd::user_group,
mode => '0644', mode => '0644',
notify => Class['Fluentd::Service'], notify => Class['Fluentd::Service'],
} }

View File

@@ -38,23 +38,16 @@
# Copyright 2015 wywy, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::filter ( define fluentd::filter (
$ensure = present, Enum['present', 'absent'] $ensure = present,
$priority = 20, Integer $priority = 20,
$pattern = '**', String $pattern = '**',
$config = {}, 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}": fluentd::config::file { "filter-${title}":
ensure => $ensure, ensure => $ensure,
priority => $priority, priority => $priority,
content => template( 'fluentd/filter.erb'), content => template( 'fluentd/filter.erb'),
} }
} }

View File

@@ -65,37 +65,24 @@
# Copyright 2015 wywy, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
class fluentd ( class fluentd (
$repo_manage = $::fluentd::params::repo_manage, Boolean $repo_manage = $::fluentd::params::repo_manage,
$package_ensure = $::fluentd::params::package_ensure, String $package_ensure = $::fluentd::params::package_ensure,
$package_name = $::fluentd::params::package_name, String $package_name = $::fluentd::params::package_name,
$package_install_options = $::fluentd::params::package_install_options, Array $package_install_options = $::fluentd::params::package_install_options,
$service_manage = $::fluentd::params::service_manage, Boolean $service_manage = $::fluentd::params::service_manage,
$service_name = $::fluentd::params::service_name, String $service_name = $::fluentd::params::service_name,
$service_ensure = $::fluentd::params::service_ensure, Enum['running', 'stopped'] $service_ensure = $::fluentd::params::service_ensure,
$service_enable = $::fluentd::params::service_enable, Boolean $service_enable = $::fluentd::params::service_enable,
$config_path = $::fluentd::params::config_path, String $config_path = $::fluentd::params::config_path,
$conf_dir = $::fluentd::params::conf_dir, String $conf_dir = $::fluentd::params::conf_dir,
$config_file = $::fluentd::params::config_file, String $config_file = $::fluentd::params::config_file,
$conf_dir_manage = $::fluentd::params::conf_dir_manage, Boolean $conf_dir_manage = $::fluentd::params::conf_dir_manage,
$user_manage = $::fluentd::params::user_manage, Boolean $user_manage = $::fluentd::params::user_manage,
$user_name = $::fluentd::params::user_name, String $user_name = $::fluentd::params::user_name,
$user_group = $::fluentd::params::user_group, String $user_group = $::fluentd::params::user_group,
$user_groups = $::fluentd::params::user_groups, Array $user_groups = $::fluentd::params::user_groups,
) inherits fluentd::params { ) 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 # class calls
include '::fluentd::repo' include '::fluentd::repo'
include '::fluentd::install' include '::fluentd::install'

View File

@@ -43,23 +43,16 @@
# Copyright 2015 wywy, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::match ( define fluentd::match (
$ensure = present, Enum['present', 'absent'] $ensure = present,
$priority = 30, Integer $priority = 30,
$pattern = '**', String $pattern = '**',
$config = {}, 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}": fluentd::config::file { "match-${title}":
ensure => $ensure, ensure => $ensure,
priority => $priority, priority => $priority,
content => template( 'fluentd/match.erb'), content => template( 'fluentd/match.erb'),
} }
} }

View File

@@ -26,9 +26,9 @@
# Copyright 2015 wywy, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::plugin ( define fluentd::plugin (
$ensure = present, String $ensure = present,
$type = 'gem', String $type = 'gem',
$source = undef, Optional[String] $source = undef,
) { ) {
case $type { case $type {
@@ -43,7 +43,6 @@ define fluentd::plugin (
if ! ($ensure in [ 'present', 'absent' ]) { if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent') fail('ensure parameter must be present or absent')
} }
validate_string($source)
fluentd::plugin::file { $name: fluentd::plugin::file { $name:
ensure => $ensure, ensure => $ensure,

View File

@@ -34,17 +34,15 @@
# Copyright 2015 wywy, unless otherwise noted. # Copyright 2015 wywy, unless otherwise noted.
# #
define fluentd::source ( define fluentd::source (
$ensure = present, String $ensure = present,
$priority = 10, Integer $priority = 10,
$config = {}, Hash $config = {},
) { ) {
# parameter validation # parameter validation
if ! ($ensure in [ 'present', 'absent' ]) { if ! ($ensure in [ 'present', 'absent' ]) {
fail('ensure parameter must be present or absent') fail('ensure parameter must be present or absent')
} }
validate_integer($priority)
validate_hash($config)
fluentd::config::file { "source-${title}": fluentd::config::file { "source-${title}":
ensure => $ensure, ensure => $ensure,

View File

@@ -1,17 +1,17 @@
{ {
"name": "wywygmbh-fluentd", "name": "pilchkinstein-fluentd",
"version": "0.6.0", "version": "1.0.0",
"author": "wywy", "author": "pilchkinstein-gtv",
"summary": "Generic module for fluentd (td-agent).", "summary": "Generic module for fluentd (td-agent).",
"license": "Apache-2.0", "license": "Apache-2.0",
"source": "https://github.com/wywy/puppet-fluentd", "source": "https://github.com/pilchkinstein-gtv/puppet-fluentd",
"project_page": "https://github.com/wywy/puppet-fluentd", "project_page": "https://github.com/pilchkinstein-gtv/puppet-fluentd",
"issues_url": "https://github.com/wywy/puppet-fluentd/issues", "issues_url": "https://github.com/pilchkinstein-gtv/puppet-fluentd/issues",
"tags": ["fluentd", "td-agent"], "tags": ["fluentd", "td-agent"],
"operatingsystem_support": [ "operatingsystem_support": [
{ {
"operatingsystem": "Ubuntu", "operatingsystem": "Ubuntu",
"operatingsystemrelease": [ "14.04", "12.04" ] "operatingsystemrelease": [ "16.04", "14.04" ]
}, },
{ {
"operatingsystem": "Debian", "operatingsystem": "Debian",
@@ -24,7 +24,7 @@
], ],
"dependencies": [ "dependencies": [
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" }, { "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 "data_provider": null
} }

View File

@@ -13,7 +13,7 @@ describe 'fluentd::filter' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
priority: '20', priority: 20,
pattern: '*.test', pattern: '*.test',
config: { config: {
'type' => 'record_transformer', 'type' => 'record_transformer',

View File

@@ -13,7 +13,7 @@ describe 'fluentd::match' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
priority: '30', priority: 30,
pattern: '*.test', pattern: '*.test',
config: { config: {
'flush_interval' => '30s', 'flush_interval' => '30s',
@@ -41,7 +41,7 @@ describe 'fluentd::match' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
priority: '30', priority: 30,
pattern: '*.test', pattern: '*.test',
config: { config: {
'type' => 'copy', 'type' => 'copy',

View File

@@ -13,11 +13,19 @@ describe 'fluentd::source' do
let(:title) { 'test' } let(:title) { 'test' }
let(:params) do let(:params) do
{ {
priority: '10', priority: 10,
config: { config: {
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage'=> {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test' 'tag' => 'application.test'
} }
} }

View File

@@ -2,5 +2,13 @@
type tail type tail
format json format json
path /var/log/test-application/*.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 tag application.test
</source> </source>

View File

@@ -1,5 +1,13 @@
<source> <source>
<% @config.each do |key, val| -%> <% @config.each do |key, val| -%>
<%- if val.is_a?( Hash ) -%>
<<%= key -%>>
<%- val.each do |key2, val2| -%>
<%= key2 -%> <%= val2 %>
<%- end -%>
</<%= key %>>
<%- else -%>
<%= key -%> <%= val %> <%= key -%> <%= val %>
<%- end -%>
<% end -%> <% end -%>
</source> </source>