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

8 Commits
0.1.0 ... 0.4.0

Author SHA1 Message Date
Jan Krause
6a08c099c4 prepare 0.4.0 release 2015-12-11 10:52:35 +01:00
Jan Krause
88f021de43 allow repeating keys in match rules
extends the match template, yes, its not pretty
readable, to support array definitions for
defining multiple server or stores.
2015-12-11 10:21:27 +01:00
Jan Krause
b5d8088d31 prepare 0.3.0 release 2015-12-09 16:06:00 +01:00
Jan Krause
31a92b59eb pin dependency modules in fixtures
also increases apt dependency
2015-12-09 16:04:47 +01:00
Jan Krause
641873546f minor changes 2015-12-09 16:04:28 +01:00
Jan Krause
a08cd1f4f4 change travis build notification 2015-12-09 14:24:28 +01:00
Max Wilhelm
428a220e1f increased stdlib dependency 2015-12-08 11:50:23 +01:00
Max Wilhelm
5a67bcac9a added version badge to README.md 2015-12-07 18:51:12 +01:00
14 changed files with 179 additions and 32 deletions

View File

@@ -1,6 +1,10 @@
fixtures: fixtures:
repositories: repositories:
apt: "https://github.com/puppetlabs/puppetlabs-apt.git" apt:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" repo: "https://github.com/puppetlabs/puppetlabs-apt.git"
ref: "2.0.0"
stdlib:
repo: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "4.6.0"
symlinks: symlinks:
fluentd: "#{source_dir}" fluentd: "#{source_dir}"

View File

@@ -1,8 +1,8 @@
---
sudo: false sudo: false
language: ruby language: ruby
bundler_args: --without system_tests bundler_args: --without system_tests
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" script: bundle exec rake validate && bundle exec rake lint && bundle exec rake spec
SPEC_OPTS='--format documentation'
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
@@ -13,4 +13,5 @@ matrix:
- rvm: 2.1.6 - rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes" env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
notifications: notifications:
email: max.wilhelm@wywy.com slack:
secure: WVBx/OJqLpX9WXyiejEdnOcAf+5ShWJ2gcyeBCX032iKzPphcdPKqH+jnlFaKjqQCZARbRqzlj/if3FZWAlhWtTrWrcY545dRHcsaGvJ/nMtdHlBUuwUNHipSn+RTXtorsYz0efhJMPye2LMl0HgAp3rEs70XUt8rZOwdedLGVgfWRwM+KixhSf8P08v9QjNRNdhWII37KFRdqv/NHryNlVKsTLH6fQOyIvok3vrTvMR8rWMRETXv6JLpCJ3FfOrxo53fW7q+GlXXuVcQ2OGlgxm3eke6q2aXZAqczeB5CSlWgUEA5T3rQ//WI3enwTayRajV/9O26HZvASjSTnDRiSSv1itYqg1Uy6kuJy5ANpBizOyWY6/QTM5Rw00AXvaY9ur0EmyNe5vLNHyTxzdr4R+rXjE07yCDvWM9RGbu+4BipP+mAoJTkuCIP54FWYn1qOJnC8DYywD/+wniCNLbp6yMgbG/aC6H5RmuSy+3xRoEbwvyXKUgA+4gL3I3aAIvidBG+yazRBFvRCn4pUJdTEc4Cpu0jhQWXWyZSE66HNPKyIOXl9JPTzul08MDo9OaqBt+K3yeMVA8EPr196mWLwerF+dExQ2PJhUu/7MAiOgFrIr4/d05iKhj4ivLYBRNN317s2NVo8qyfhPHlfv6PyzhllC/qjClQ2rLOemVhg=

View File

@@ -1,4 +1,15 @@
# Changelog # Changelog
## 0.4.0
* Allows definition of multiple directives in matching rules
## 0.3.0
* Increased apt dependency
* Module pinning on rspec tests
* Minor changes
## 0.2.0
* Increased stdlib dependency
## 0.1.0 ## 0.1.0
Initial release * Initial release

View File

@@ -1,7 +1,10 @@
# wywygmbh/fluentd Puppet Module # wywygmbh/fluentd Puppet Module
[![GitHub version](https://badge.fury.io/gh/wywygmbh%2Fpuppet-fluentd.svg)](https://github.com/wywygmbh/puppet-fluentd)
[![Build Status](https://travis-ci.org/wywygmbh/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywygmbh/puppet-fluentd) [![Build Status](https://travis-ci.org/wywygmbh/puppet-fluentd.svg?branch=master)](https://travis-ci.org/wywygmbh/puppet-fluentd)
#### Table of Contents #### Table of Contents
1. [Description](#description) 1. [Description](#description)
@@ -11,6 +14,7 @@
* [Source](#source) * [Source](#source)
* [Filter](#filter) * [Filter](#filter)
* [Match](#match) * [Match](#match)
* [Match Store](#match-store)
* [Plugin Installation](#plugin-installation) * [Plugin Installation](#plugin-installation)
* [Requirements](#requirements) * [Requirements](#requirements)
1. [Limitations - OS compatibility, etc.](#limitations) 1. [Limitations - OS compatibility, etc.](#limitations)
@@ -94,9 +98,9 @@ include '::fluentd'
'shared_key' => 'my_shared_key', 'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com', 'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert', 'ca_cert_path' => '/path/to/ca.cert',
'servers' => { 'server' => [{
'host' => 'test.server.com' 'host' => 'test.server.com',
} }]
} }
} }
``` ```
@@ -110,9 +114,48 @@ include '::fluentd'
shared_key my_shared_key shared_key my_shared_key
self_hostname instance.test.com self_hostname instance.test.com
ca_cert_path /path/to/ca.cert ca_cert_path /path/to/ca.cert
<servers> <server>
host test.server.com host test.server.com
</servers> </server>
</match>
```
### Match Store
```puppet
::fluentd::match { 'test':
priority => 30,
pattern => '*.test',
config: {
'type' => 'copy',
'store' => [
{
'type' => 'elasticsearch',
'logstashformat' => true,
'hosts' => '172.20.10.17:9200',
'flush_interval' => '30s',
},
{
'type' => 'file',
'path' => '/tmp/td-agent-debug.log',
}
]
}
}
```
**creates:**
```
/etc/td-agent/conf.d/30-match-test.conf
<match *.test>
type copy
<store>
type elasticsearch
logstash_format true
hosts 172.20.10.17:9200
flush_interval 30s
</store>
<store>
type file
path /tmp/crs
</store>
</match> </match>
``` ```

View File

@@ -9,8 +9,27 @@
'shared_key' => 'my_shared_key', 'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com', 'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert', 'ca_cert_path' => '/path/to/ca.cert',
'servers' => { 'server' => [{
'host' => 'test.server.com' 'host' => 'test.server.com',
}]
} }
} }
::fluentd::match { 'test':
priority => 30,
pattern => '*.test',
config => {
'type' => 'copy',
'store' => [{
'type' => 'elasticsearch',
'logstashformat' => true,
'hosts' => '172.20.10.17:9200',
'flush_interval' => '30s',
},
{
'type' => 'file',
'path' => '/tmp/td-agent-debug.log',
}
]
}
} }

View File

@@ -1,4 +1,4 @@
# Configure package # Configure config files/directories
# #
class fluentd::config inherits fluentd { class fluentd::config inherits fluentd {
@@ -16,5 +16,4 @@ class fluentd::config inherits fluentd {
group => $::fluentd::user_group, group => $::fluentd::user_group,
mode => '0750', mode => '0750',
} }
} }

View File

@@ -64,6 +64,7 @@ class fluentd (
validate_bool($service_manage) validate_bool($service_manage)
validate_string($service_name) validate_string($service_name)
validate_bool($service_enable) validate_bool($service_enable)
if ! ($service_ensure in [ 'running', 'stopped' ]) { if ! ($service_ensure in [ 'running', 'stopped' ]) {
fail('service_ensure parameter must be running or stopped') fail('service_ensure parameter must be running or stopped')
} }
@@ -79,5 +80,4 @@ class fluentd (
Class['::Fluentd::Install'] -> Class['::Fluentd::Install'] ->
Class['::Fluentd::Config'] -> Class['::Fluentd::Config'] ->
Class['::Fluentd::Service'] Class['::Fluentd::Service']
} }

View File

@@ -31,9 +31,9 @@
# 'shared_key' => 'my_shared_key', # 'shared_key' => 'my_shared_key',
# 'self_hostname' => 'instance.test.com', # 'self_hostname' => 'instance.test.com',
# 'ca_cert_path' => '/path/to/ca.cert', # 'ca_cert_path' => '/path/to/ca.cert',
# 'servers' => { # 'server' => [{
# 'host' => 'test.server.com' # 'host' => 'test.server.com'
# } # }]
# } # }
# } # }
# #

View File

@@ -40,7 +40,7 @@ define fluentd::plugin (
'gem': { 'gem': {
fluentd::plugin::gem { $name: fluentd::plugin::gem { $name:
ensure => $ensure, ensure => $ensure,
require => Class['Fluentd::Install'] require => Class['Fluentd::Install'],
} }
} }
'file': { 'file': {
@@ -49,7 +49,7 @@ define fluentd::plugin (
fluentd::plugin::file { $name: fluentd::plugin::file { $name:
ensure => $ensure, ensure => $ensure,
source => $source, source => $source,
require => Class['Fluentd::Install'] require => Class['Fluentd::Install'],
} }
} }
default: { default: {

View File

@@ -11,6 +11,6 @@ define fluentd::plugin::gem (
package { $name: package { $name:
ensure => $ensure, ensure => $ensure,
provider => 'fluentd_gem', provider => 'fluentd_gem',
notify => Class['Fluentd::Service'] notify => Class['Fluentd::Service'],
} }
} }

View File

@@ -1,4 +1,4 @@
# Configure package # Configure service
# #
class fluentd::service inherits fluentd { class fluentd::service inherits fluentd {

View File

@@ -1,6 +1,6 @@
{ {
"name": "wywygmbh-fluentd", "name": "wywygmbh-fluentd",
"version": "0.1.0", "version": "0.4.0",
"author": "wywy GmbH", "author": "wywy GmbH",
"summary": "Generic module for fluentd (td-agent).", "summary": "Generic module for fluentd (td-agent).",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -15,8 +15,8 @@
} }
], ],
"dependencies": [ "dependencies": [
{ "name":"puppetlabs-stdlib","version_requirement":">= 1.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.6.0 < 5.0.0" },
{ "name": "puppetlabs/apt", "version_requirement": ">= 1.8.0 < 3.0.0" } { "name": "puppetlabs/apt", "version_requirement": ">= 2.0.0 < 3.0.0" }
], ],
"data_provider": null "data_provider": null
} }

View File

@@ -24,9 +24,11 @@ describe 'fluentd::match' do
'shared_key' => 'my_shared_key', 'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com', 'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert', 'ca_cert_path' => '/path/to/ca.cert',
'servers' => { 'server' => [
'host' => 'test.server.com' {
'host' => 'test.server.com',
} }
]
} }
} }
end end
@@ -40,9 +42,51 @@ describe 'fluentd::match' do
with_content(/shared_key my_shared_key/). with_content(/shared_key my_shared_key/).
with_content(/self_hostname instance.test.com/). with_content(/self_hostname instance.test.com/).
with_content(/ca_cert_path \/path\/to\/ca.cert/). with_content(/ca_cert_path \/path\/to\/ca.cert/).
with_content(/<servers>/). with_content(/<server>/).
with_content(/host test.server.com/). with_content(/host test.server.com/).
with_content(/<\/servers>/). with_content(/<\/server>/).
with_content(/<\/match>/)
end
end
context 'multiple store' do
let(:title) { 'test' }
let(:params) do
{
priority: '30',
pattern: '*.test',
config: {
'type' => 'copy',
'store' => [
{
'type' => 'elasticsearch',
'logstashformat' => true,
'hosts' => '172.20.10.17:9200',
'flush_interval' => '30s',
},
{
'type' => 'file',
'path' => '/tmp/td-agent-debug.log',
}
]
}
}
end
it do
is_expected.to contain_file('/etc/td-agent/conf.d/30-match-test.conf').
with_content(/<match \*.test>/).
with_content(/type copy/).
with_content(/<store>/).
with_content(/type elasticsearch/).
with_content(/logstashformat true/).
with_content(/hosts 172.20.10.17:9200/).
with_content(/flush_interval 30s/).
with_content(/<\/store>/).
with_content(/<store>/).
with_content(/type file/).
with_content(/path \/tmp\/td-agent-debug.log/).
with_content(/<\/store>/).
with_content(/<\/match>/) with_content(/<\/match>/)
end end
end end

View File

@@ -6,6 +6,32 @@
<%= key -%> <%= val %> <%= key -%> <%= val %>
<%- end -%> <%- end -%>
</<%= key %>> </<%= key %>>
<%- elsif val.is_a?( Array ) -%>
<%- val.each do |k, v| -%>
<<%= key -%>>
<%- if k.is_a?( Hash ) -%>
<%- k.each do |x, y| -%>
<%- if y.is_a?( Array ) -%>
<%- y.each do |a, b| -%>
<<%= x -%>>
<%- if a.is_a?( Hash ) -%>
<%- a.each do |c, d| -%>
<%= c -%> <%= d %>
<%- end -%>
<%- else -%>
<%= a -%> <%= b %>
<%- end -%>
</<%= x %>>
<%- end -%>
<%- else -%>
<%= x -%> <%= y %>
<%- end -%>
<%- end -%>
<%- else -%>
<%= k -%> <%= v %>
<%- end -%>
</<%= key %>>
<%- end -%>
<%- else -%> <%- else -%>
<%= key -%> <%= val %> <%= key -%> <%= val %>
<%- end -%> <%- end -%>