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

6 Commits
0.2.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
14 changed files with 174 additions and 33 deletions

View File

@@ -1,6 +1,10 @@
fixtures:
repositories:
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
apt:
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:
fluentd: "#{source_dir}"

View File

@@ -1,8 +1,8 @@
---
sudo: false
language: ruby
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:
fast_finish: true
include:
@@ -13,4 +13,5 @@ matrix:
- rvm: 2.1.6
env: PUPPET_GEM_VERSION="~> 4.0" STRICT_VARIABLES="yes"
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,7 +1,15 @@
# 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
* Increased stdlib dependency
## 0.1.0
Initial release
* Initial release

View File

@@ -14,6 +14,7 @@
* [Source](#source)
* [Filter](#filter)
* [Match](#match)
* [Match Store](#match-store)
* [Plugin Installation](#plugin-installation)
* [Requirements](#requirements)
1. [Limitations - OS compatibility, etc.](#limitations)
@@ -97,9 +98,9 @@ include '::fluentd'
'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert',
'servers' => {
'host' => 'test.server.com'
}
'server' => [{
'host' => 'test.server.com',
}]
}
}
```
@@ -113,9 +114,48 @@ include '::fluentd'
shared_key my_shared_key
self_hostname instance.test.com
ca_cert_path /path/to/ca.cert
<servers>
<server>
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>
```

View File

@@ -9,8 +9,27 @@
'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert',
'servers' => {
'host' => 'test.server.com'
}
'server' => [{
'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 {
@@ -16,5 +16,4 @@ class fluentd::config inherits fluentd {
group => $::fluentd::user_group,
mode => '0750',
}
}

View File

@@ -64,6 +64,7 @@ class fluentd (
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')
}
@@ -79,5 +80,4 @@ class fluentd (
Class['::Fluentd::Install'] ->
Class['::Fluentd::Config'] ->
Class['::Fluentd::Service']
}

View File

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

View File

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

View File

@@ -11,6 +11,6 @@ define fluentd::plugin::gem (
package { $name:
ensure => $ensure,
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 {

View File

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

View File

@@ -24,9 +24,11 @@ describe 'fluentd::match' do
'shared_key' => 'my_shared_key',
'self_hostname' => 'instance.test.com',
'ca_cert_path' => '/path/to/ca.cert',
'servers' => {
'host' => 'test.server.com'
}
'server' => [
{
'host' => 'test.server.com',
}
]
}
}
end
@@ -40,10 +42,52 @@ describe 'fluentd::match' do
with_content(/shared_key my_shared_key/).
with_content(/self_hostname instance.test.com/).
with_content(/ca_cert_path \/path\/to\/ca.cert/).
with_content(/<servers>/).
with_content(/<server>/).
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>/)
end
end
end

View File

@@ -6,6 +6,32 @@
<%= key -%> <%= val %>
<%- end -%>
</<%= 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 -%>
<%= key -%> <%= val %>
<%- end -%>