1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-09-19 20:20:35 +00:00

Merge 'feature/extend_templates_for_fluentd_0_14'

This commit is contained in:
Kris Lamoureux 2020-04-02 12:32:51 -04:00
commit bbc4e06d07
Signed by: kris
GPG Key ID: A30022791E1719A4
3 changed files with 62 additions and 9 deletions

View File

@ -15,6 +15,7 @@
* [Source](#source)
* [Filter](#filter)
* [Match](#match)
* [Match with buffer and chunk_keys](#match-with-buffer-and-chunk_keys)
* [Match Store](#match-store)
* [Plugin Installation](#plugin-installation)
* [Requirements](#requirements)
@ -88,7 +89,7 @@ include '::fluentd'
Path to configuration files
**Default:** '/etc/td-agent'
`config_dir`
Configuration directory name
@ -139,7 +140,10 @@ include '::fluentd'
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test'
'tag' => 'application.test',
'parse' => {
'message_format' => 'auto'
}
}
}
```
@ -159,6 +163,9 @@ include '::fluentd'
path test.pos
</storage>
tag application.test
<parse>
message_format auto
</parse>
</source>
```
#### Filter
@ -217,7 +224,41 @@ include '::fluentd'
</server>
</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
::fluentd::match { 'test':
priority => 30,
@ -233,7 +274,13 @@ include '::fluentd'
},
{
'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>
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>
</match>
```

View File

@ -1,7 +1,8 @@
<match <%= @pattern %>>
<% @config.each do |key, val| -%>
<%- if key == 'buffer_chunk_keys'; next; end-%>
<%- 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| -%>
<%= key -%> <%= val %>
<%- end -%>
@ -13,7 +14,7 @@
<%- k.each do |x, y| -%>
<%- if y.is_a?( Array ) -%>
<%- 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 ) -%>
<%- a.each do |c, d| -%>
<%= c -%> <%= d %>
@ -24,6 +25,7 @@
</<%= x %>>
<%- end -%>
<%- else -%>
<%- if x == 'buffer_chunk_keys'; next; end -%>
<%= x -%> <%= y %>
<%- end -%>
<%- end -%>

View File

@ -2,8 +2,8 @@
<% @config.each do |key, val| -%>
<%- if val.is_a?( Hash ) -%>
<<%= key -%>>
<%- val.each do |key2, val2| -%>
<%= key2 -%> <%= val2 %>
<%- val.each do |key, val| -%>
<%= key -%> <%= val %>
<%- end -%>
</<%= key %>>
<%- else -%>