mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-09-13 08:59:29 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6a08c099c4 | ||
|
88f021de43 | ||
|
b5d8088d31 | ||
|
31a92b59eb | ||
|
641873546f | ||
|
a08cd1f4f4 | ||
|
428a220e1f | ||
|
5a67bcac9a |
@@ -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}"
|
||||
|
@@ -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=
|
||||
|
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,4 +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
|
||||
|
||||
## 0.1.0
|
||||
Initial release
|
||||
* Initial release
|
||||
|
53
README.md
53
README.md
@@ -1,7 +1,10 @@
|
||||
# wywygmbh/fluentd Puppet Module
|
||||
|
||||
[](https://github.com/wywygmbh/puppet-fluentd)
|
||||
[](https://travis-ci.org/wywygmbh/puppet-fluentd)
|
||||
|
||||
|
||||
|
||||
#### Table of Contents
|
||||
|
||||
1. [Description](#description)
|
||||
@@ -11,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)
|
||||
@@ -94,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',
|
||||
}]
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -110,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>
|
||||
```
|
||||
|
||||
|
@@ -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',
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@@ -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',
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -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']
|
||||
|
||||
}
|
||||
|
@@ -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'
|
||||
# }
|
||||
# }]
|
||||
# }
|
||||
# }
|
||||
#
|
||||
|
@@ -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: {
|
||||
|
@@ -11,6 +11,6 @@ define fluentd::plugin::gem (
|
||||
package { $name:
|
||||
ensure => $ensure,
|
||||
provider => 'fluentd_gem',
|
||||
notify => Class['Fluentd::Service']
|
||||
notify => Class['Fluentd::Service'],
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Configure package
|
||||
# Configure service
|
||||
#
|
||||
class fluentd::service inherits fluentd {
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wywygmbh-fluentd",
|
||||
"version": "0.1.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":">= 1.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
|
||||
}
|
||||
|
@@ -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,9 +42,51 @@ 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
|
||||
|
@@ -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 -%>
|
||||
|
Reference in New Issue
Block a user