mirror of
https://github.com/krislamo/puppet-fluentd
synced 2025-04-10 15:34:21 +00:00
Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
6620a30633 | |||
bbc4e06d07 | |||
|
ff5ea7563a | ||
|
526fd7a84e | ||
|
e880d11f51 | ||
|
19820e5e2a | ||
|
45449583d9 |
61
README.md
61
README.md
@ -15,6 +15,7 @@
|
|||||||
* [Source](#source)
|
* [Source](#source)
|
||||||
* [Filter](#filter)
|
* [Filter](#filter)
|
||||||
* [Match](#match)
|
* [Match](#match)
|
||||||
|
* [Match with buffer and chunk_keys](#match-with-buffer-and-chunk_keys)
|
||||||
* [Match Store](#match-store)
|
* [Match Store](#match-store)
|
||||||
* [Plugin Installation](#plugin-installation)
|
* [Plugin Installation](#plugin-installation)
|
||||||
* [Requirements](#requirements)
|
* [Requirements](#requirements)
|
||||||
@ -88,7 +89,7 @@ include '::fluentd'
|
|||||||
|
|
||||||
Path to configuration files
|
Path to configuration files
|
||||||
**Default:** '/etc/td-agent'
|
**Default:** '/etc/td-agent'
|
||||||
|
|
||||||
`config_dir`
|
`config_dir`
|
||||||
|
|
||||||
Configuration directory name
|
Configuration directory name
|
||||||
@ -139,7 +140,10 @@ include '::fluentd'
|
|||||||
'type' => 'local',
|
'type' => 'local',
|
||||||
'path' => 'test.pos'
|
'path' => 'test.pos'
|
||||||
},
|
},
|
||||||
'tag' => 'application.test'
|
'tag' => 'application.test',
|
||||||
|
'parse' => {
|
||||||
|
'message_format' => 'auto'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -159,6 +163,9 @@ include '::fluentd'
|
|||||||
path test.pos
|
path test.pos
|
||||||
</storage>
|
</storage>
|
||||||
tag application.test
|
tag application.test
|
||||||
|
<parse>
|
||||||
|
message_format auto
|
||||||
|
</parse>
|
||||||
</source>
|
</source>
|
||||||
```
|
```
|
||||||
#### Filter
|
#### Filter
|
||||||
@ -217,7 +224,41 @@ include '::fluentd'
|
|||||||
</server>
|
</server>
|
||||||
</match>
|
</match>
|
||||||
```
|
```
|
||||||
### Match Store
|
#### Match with buffer and chunk_keys
|
||||||
|
|
||||||
|
buffer_chunk_keys will not be included in the template. They will be filtered and only be used as a "pattern" for the buffer section.
|
||||||
|
|
||||||
|
```
|
||||||
|
::fluentd::match { 'test':
|
||||||
|
priority => 98,
|
||||||
|
pattern => 'test.**',
|
||||||
|
config => {
|
||||||
|
type => 'file',
|
||||||
|
path => '/var/log/td-agent/test/${host}',
|
||||||
|
append => true,
|
||||||
|
buffer_chunk_keys => 'host',
|
||||||
|
buffer => {
|
||||||
|
type => file,
|
||||||
|
path => /var/log/td-agent/test/buffer/,
|
||||||
|
flush_mode => immediate,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
```
|
||||||
|
**creates:**
|
||||||
|
```
|
||||||
|
<match test.**>
|
||||||
|
type file
|
||||||
|
path /var/log/td-agent/test/${host}
|
||||||
|
append true
|
||||||
|
<buffer host>
|
||||||
|
type file
|
||||||
|
path /var/log/td-agent/test/buffer/
|
||||||
|
flush_mode immediate
|
||||||
|
</buffer>
|
||||||
|
</match>
|
||||||
|
```
|
||||||
|
#### Match Store
|
||||||
```puppet
|
```puppet
|
||||||
::fluentd::match { 'test':
|
::fluentd::match { 'test':
|
||||||
priority => 30,
|
priority => 30,
|
||||||
@ -233,7 +274,13 @@ include '::fluentd'
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'type' => 'file',
|
'type' => 'file',
|
||||||
'path' => '/tmp/td-agent-debug.log',
|
'path' => '/tmp/td-agent-debug-${host}.log',
|
||||||
|
'buffer_chunk_keys' => 'host',
|
||||||
|
'buffer' => [{
|
||||||
|
'@type' => 'file',
|
||||||
|
path => '/var/log/td-agent/buffer/',
|
||||||
|
flush_mode => 'immediate',
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -252,7 +299,11 @@ include '::fluentd'
|
|||||||
</store>
|
</store>
|
||||||
<store>
|
<store>
|
||||||
type file
|
type file
|
||||||
path /tmp/crs
|
path /tmp/td-agent-debug-${host}.log
|
||||||
|
<buffer host>
|
||||||
|
@type file
|
||||||
|
path /var/log/td-agent/buffer/
|
||||||
|
flush_mode immediate
|
||||||
</store>
|
</store>
|
||||||
</match>
|
</match>
|
||||||
```
|
```
|
||||||
|
30
files/GPG-KEY-td-agent
Normal file
30
files/GPG-KEY-td-agent
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||||
|
Comment: Encryption subkey has been removed due to apt-key parsing bug
|
||||||
|
|
||||||
|
mQINBFhiI8wBEADThWLNd8IKPRw7Ygu3DHS4Sb/Yc6vSZSaMGJ6Wkj245jScvI+C
|
||||||
|
nG4C4rtO/8ObUj5cUpb4CyfYZX8W4tp9x+W68c4paXevG4s+X4EE3uUsgdwTnFXi
|
||||||
|
GMa57QDzR4p/JvjUjfGJ2UAr4Bfj8Q2S54LmIu6UAe82ce2B4tEHCeYSxkmVUDAZ
|
||||||
|
utfmgKoVTbnceTemU0m5ANS6IC1/53KEhgB1sKm5G/FjRJGslHWb3mf+bLrhmlkP
|
||||||
|
pA4BOKF2w3eFYH3LhWskxMS0SPM7J6aq+6LyNNqtlKL6lUS7qVjRQ6PlgFcmtG4J
|
||||||
|
tijsZI62bDn1f44DmeLY+LMS/nM0xyIx94lYumGH5EYmjUECagqMool98/+Wx79A
|
||||||
|
Thtg/1pYNzo8Z76qr0i3xLSRtsQ2Om2Rfal7VGadOrx4sqlkSaUaGI+hBc1r4tNy
|
||||||
|
tERvBEMGSf78bWDbdzxSNEW4LUDUpniNQb0DrURfWkqRa3q4WcTJr8lpQM/NmAru
|
||||||
|
owayAXQwKob+OIZ09/O69EaqVJ9MqsM3keQouSHShKvzNrppuo3D3z+Dpy05FsYw
|
||||||
|
MAiIN7auXxy+XQwCVsKF083YaDHcC0I22GReEgt43yZXQ/b/J9QNrm5nJ+3Cpso3
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AYU=
|
||||||
|
=TPyg
|
||||||
|
-----END PGP PUBLIC KEY BLOCK-----
|
@ -8,11 +8,20 @@ Puppet::Type.type(:package).provide :fluentd_gem, :parent => :gem do
|
|||||||
not a valid URL, it will be interpreted as the path to a local gem file. If
|
not a valid URL, it will be interpreted as the path to a local gem file. If
|
||||||
source is not present at all, the gem will be installed from the default gem
|
source is not present at all, the gem will be installed from the default gem
|
||||||
repositories."
|
repositories."
|
||||||
confine :exists => "/opt/td-agent/embedded/bin/gem"
|
confine :exists => "/opt/td-agent/bin/gem"
|
||||||
|
|
||||||
has_feature :versionable, :install_options
|
has_feature :versionable, :install_options
|
||||||
|
|
||||||
commands :gemcmd => "/opt/td-agent/embedded/bin/gem"
|
commands :gemcmd => "/opt/td-agent/bin/gem"
|
||||||
|
|
||||||
|
def install(useversion = true)
|
||||||
|
command = [command(:gemcmd), "install"]
|
||||||
|
command << "--no-document" << resource[:name]
|
||||||
|
output = execute(command)
|
||||||
|
|
||||||
|
# Apparently some stupid gem versions don't exit non-0 on failure
|
||||||
|
self.fail "Could not install: #{output.chomp}" if output.include?("ERROR")
|
||||||
|
end
|
||||||
|
|
||||||
def uninstall
|
def uninstall
|
||||||
command = [command(:gemcmd), "uninstall"]
|
command = [command(:gemcmd), "uninstall"]
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
# [*repo_manage*]
|
# [*repo_manage*]
|
||||||
# Include repository to install recent fluentd (td-agent) from
|
# Include repository to install recent fluentd (td-agent) from
|
||||||
# Default: 'true'
|
# Default: 'true'
|
||||||
|
# [*repo_version*]
|
||||||
|
# The major version of td-agent to install
|
||||||
|
# Default: 3
|
||||||
# [*package_ensure*]
|
# [*package_ensure*]
|
||||||
# Package ensure
|
# Package ensure
|
||||||
# Default: 'installed'
|
# Default: 'installed'
|
||||||
@ -66,6 +69,7 @@
|
|||||||
#
|
#
|
||||||
class fluentd (
|
class fluentd (
|
||||||
Boolean $repo_manage = $::fluentd::params::repo_manage,
|
Boolean $repo_manage = $::fluentd::params::repo_manage,
|
||||||
|
Integer $repo_version = $::fluentd::params::repo_version,
|
||||||
String $package_ensure = $::fluentd::params::package_ensure,
|
String $package_ensure = $::fluentd::params::package_ensure,
|
||||||
String $package_name = $::fluentd::params::package_name,
|
String $package_name = $::fluentd::params::package_name,
|
||||||
Array $package_install_options = $::fluentd::params::package_install_options,
|
Array $package_install_options = $::fluentd::params::package_install_options,
|
||||||
@ -90,6 +94,12 @@ class fluentd (
|
|||||||
include '::fluentd::config'
|
include '::fluentd::config'
|
||||||
include '::fluentd::service'
|
include '::fluentd::service'
|
||||||
|
|
||||||
|
# Realize any virtual configurations
|
||||||
|
Fluentd::Plugin <| |>
|
||||||
|
Fluentd::Source <| |>
|
||||||
|
Fluentd::Filter <| |>
|
||||||
|
Fluentd::Match <| |>
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
Class['::Fluentd::Repo']
|
Class['::Fluentd::Repo']
|
||||||
-> Class['::Fluentd::Install']
|
-> Class['::Fluentd::Install']
|
||||||
|
@ -18,6 +18,8 @@ class fluentd::params {
|
|||||||
$user_name = 'td-agent'
|
$user_name = 'td-agent'
|
||||||
$user_group = 'td-agent'
|
$user_group = 'td-agent'
|
||||||
$user_groups = ['adm']
|
$user_groups = ['adm']
|
||||||
|
# repo params
|
||||||
|
$repo_version = 4
|
||||||
|
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
|
@ -4,7 +4,7 @@ class fluentd::repo inherits fluentd {
|
|||||||
if $::fluentd::repo_manage {
|
if $::fluentd::repo_manage {
|
||||||
case $::osfamily {
|
case $::osfamily {
|
||||||
'Debian': {
|
'Debian': {
|
||||||
include ::fluentd::repo::apt
|
contain ::fluentd::repo::apt
|
||||||
}
|
}
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
include ::fluentd::repo::yum
|
include ::fluentd::repo::yum
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
#
|
#
|
||||||
class fluentd::repo::apt (
|
class fluentd::repo::apt (
|
||||||
$ensure = 'present',
|
$ensure = 'present',
|
||||||
$location = downcase("http://packages.treasuredata.com/2/${::lsbdistid}/${::lsbdistcodename}"),
|
$location = downcase("http://packages.treasuredata.com/${::fluentd::repo_version}/${::lsbdistid}/${::lsbdistcodename}"),
|
||||||
$release = $::lsbdistcodename,
|
$release = $::lsbdistcodename,
|
||||||
$repos = 'contrib',
|
$repos = 'contrib',
|
||||||
$architecture = $::architecture,
|
$architecture = $::architecture,
|
||||||
$key = {
|
$key = {
|
||||||
'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE',
|
'id' => 'BEE682289B2217F45AF4CC3F901F9177AB97ACBE',
|
||||||
'source' => 'http://packages.treasuredata.com/GPG-KEY-td-agent'
|
'content' => file('fluentd/GPG-KEY-td-agent'),
|
||||||
},
|
},
|
||||||
$include = {
|
$include = {
|
||||||
'src' => false,
|
'src' => false,
|
||||||
@ -27,4 +27,6 @@ class fluentd::repo::apt (
|
|||||||
key => $key,
|
key => $key,
|
||||||
include => $include,
|
include => $include,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Class['apt::update'] -> Package['fluentd']
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
class fluentd::repo::yum (
|
class fluentd::repo::yum (
|
||||||
$ensure = 'present',
|
$ensure = 'present',
|
||||||
$descr = 'TreasureData',
|
$descr = 'TreasureData',
|
||||||
$baseurl = 'https://packages.treasuredata.com/2/redhat/$releasever/$basearch',
|
$baseurl = "https://packages.treasuredata.com/${::fluentd::repo_version}/redhat/\$releasever/\$basearch",
|
||||||
$enabled = '1',
|
$enabled = '1',
|
||||||
$gpgcheck = '1',
|
$gpgcheck = '1',
|
||||||
$gpgkey = 'https://packages.treasuredata.com/GPG-KEY-td-agent',
|
$gpgkey = 'https://packages.treasuredata.com/GPG-KEY-td-agent',
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<match <%= @pattern %>>
|
<match <%= @pattern %>>
|
||||||
<% @config.each do |key, val| -%>
|
<% @config.each do |key, val| -%>
|
||||||
|
<%- if key == 'buffer_chunk_keys'; next; end-%>
|
||||||
<%- if val.is_a?( Hash ) -%>
|
<%- if val.is_a?( Hash ) -%>
|
||||||
<<%= key -%>>
|
<<%= key -%><%- if key == 'buffer' && !@config['buffer_chunk_keys'].nil? -%> <%= @config['buffer_chunk_keys'] -%><%- end -%>>
|
||||||
<%- val.each do |key, val| -%>
|
<%- val.each do |key, val| -%>
|
||||||
<%= key -%> <%= val %>
|
<%= key -%> <%= val %>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
@ -13,7 +14,7 @@
|
|||||||
<%- k.each do |x, y| -%>
|
<%- k.each do |x, y| -%>
|
||||||
<%- if y.is_a?( Array ) -%>
|
<%- if y.is_a?( Array ) -%>
|
||||||
<%- y.each do |a, b| -%>
|
<%- y.each do |a, b| -%>
|
||||||
<<%= x -%>>
|
<<%= x -%><%- if x == 'buffer' && !k['buffer_chunk_keys'].nil? -%> <%= k['buffer_chunk_keys'] -%><%- end -%>>
|
||||||
<%- if a.is_a?( Hash ) -%>
|
<%- if a.is_a?( Hash ) -%>
|
||||||
<%- a.each do |c, d| -%>
|
<%- a.each do |c, d| -%>
|
||||||
<%= c -%> <%= d %>
|
<%= c -%> <%= d %>
|
||||||
@ -24,6 +25,7 @@
|
|||||||
</<%= x %>>
|
</<%= x %>>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<%- else -%>
|
<%- else -%>
|
||||||
|
<%- if x == 'buffer_chunk_keys'; next; end -%>
|
||||||
<%= x -%> <%= y %>
|
<%= x -%> <%= y %>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
<% @config.each do |key, val| -%>
|
<% @config.each do |key, val| -%>
|
||||||
<%- if val.is_a?( Hash ) -%>
|
<%- if val.is_a?( Hash ) -%>
|
||||||
<<%= key -%>>
|
<<%= key -%>>
|
||||||
<%- val.each do |key2, val2| -%>
|
<%- val.each do |key, val| -%>
|
||||||
<%= key2 -%> <%= val2 %>
|
<%= key -%> <%= val %>
|
||||||
<%- end -%>
|
<%- end -%>
|
||||||
</<%= key %>>
|
</<%= key %>>
|
||||||
<%- else -%>
|
<%- else -%>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user