mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-09-13 08:59:29 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6a08c099c4 | ||
|
88f021de43 | ||
|
b5d8088d31 | ||
|
31a92b59eb | ||
|
641873546f | ||
|
a08cd1f4f4 |
@@ -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}"
|
||||||
|
@@ -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=
|
||||||
|
12
CHANGELOG.md
12
CHANGELOG.md
@@ -1,7 +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
|
## 0.2.0
|
||||||
Increased stdlib dependency
|
* Increased stdlib dependency
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
Initial release
|
* Initial release
|
||||||
|
50
README.md
50
README.md
@@ -14,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)
|
||||||
@@ -97,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',
|
||||||
}
|
}]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -113,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>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@@ -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',
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -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',
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -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']
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -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'
|
||||||
# }
|
# }]
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
|
@@ -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: {
|
||||||
|
@@ -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'],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
# Configure package
|
# Configure service
|
||||||
#
|
#
|
||||||
class fluentd::service inherits fluentd {
|
class fluentd::service inherits fluentd {
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wywygmbh-fluentd",
|
"name": "wywygmbh-fluentd",
|
||||||
"version": "0.2.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":">= 4.6.0 < 5.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
|
||||||
}
|
}
|
||||||
|
@@ -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
|
||||||
|
@@ -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 -%>
|
||||||
|
Reference in New Issue
Block a user