mirror of
https://github.com/krislamo/puppet-fluentd
synced 2024-11-10 04:50:34 +00:00
Extend templates for fluentd 0.14 new sections
- extend source to support format and parse section - extend match to support buffers with chunk keys - update readme
This commit is contained in:
parent
71352ea6b1
commit
45449583d9
59
README.md
59
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)
|
||||||
@ -131,7 +132,10 @@ include '::fluentd'
|
|||||||
'type' => 'tail',
|
'type' => 'tail',
|
||||||
'format' => 'json',
|
'format' => 'json',
|
||||||
'path' => '/var/log/test-application/*.json',
|
'path' => '/var/log/test-application/*.json',
|
||||||
'tag' => 'application.test'
|
'tag' => 'application.test',
|
||||||
|
'parse' => {
|
||||||
|
'message_format' => 'auto'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -143,6 +147,9 @@ include '::fluentd'
|
|||||||
format json
|
format json
|
||||||
path /var/log/test-application/*.json
|
path /var/log/test-application/*.json
|
||||||
tag application.test
|
tag application.test
|
||||||
|
<parse>
|
||||||
|
message_format auto
|
||||||
|
</parse>
|
||||||
</source>
|
</source>
|
||||||
```
|
```
|
||||||
#### Filter
|
#### Filter
|
||||||
@ -201,7 +208,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,
|
||||||
@ -217,7 +258,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',
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -236,7 +283,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>
|
||||||
```
|
```
|
||||||
|
@ -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 -%>
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
<source>
|
<source>
|
||||||
<% @config.each do |key, val| -%>
|
<% @config.each do |key, val| -%>
|
||||||
|
<%- if val.is_a?( Hash ) -%>
|
||||||
|
<<%= key -%>>
|
||||||
|
<%- val.each do |key, val| -%>
|
||||||
<%= key -%> <%= val %>
|
<%= key -%> <%= val %>
|
||||||
|
<%- end -%>
|
||||||
|
</<%= key %>>
|
||||||
|
<%- else -%>
|
||||||
|
<%= key -%> <%= val %>
|
||||||
|
<%- end -%>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
</source>
|
</source>
|
||||||
|
Loading…
Reference in New Issue
Block a user