1
0
mirror of https://github.com/krislamo/puppet-fluentd synced 2024-12-16 05:10:36 +00:00

Merge pull request #1 from pilchkinstein-gtv/source_parse_storage

Implemented <parse>, <storage> etc sections within fluentd::source template
This commit is contained in:
Andy Pritchard 2018-03-05 09:13:34 +00:00 committed by GitHub
commit 59fb7919a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 4 deletions

View File

@ -131,6 +131,14 @@ include '::fluentd'
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage'=> {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test' 'tag' => 'application.test'
} }
} }
@ -142,6 +150,14 @@ include '::fluentd'
type tail type tail
format json format json
path /var/log/test-application/*.json path /var/log/test-application/*.json
<parse>
type regexp
expression ^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$
</parse>
<storage>
type local
path test.pos
</storage>
tag application.test tag application.test
</source> </source>
``` ```

View File

@ -2,9 +2,17 @@
::fluentd::source { 'test': ::fluentd::source { 'test':
priority => 10, priority => 10,
config => { config => {
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'tag' => 'application.test' 'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage' => {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test'
} }
} }

View File

@ -18,6 +18,14 @@ describe 'fluentd::source' do
'type' => 'tail', 'type' => 'tail',
'format' => 'json', 'format' => 'json',
'path' => '/var/log/test-application/*.json', 'path' => '/var/log/test-application/*.json',
'parse' => {
'type' => 'regexp',
'expression' => '^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$'
},
'storage'=> {
'type' => 'local',
'path' => 'test.pos'
},
'tag' => 'application.test' 'tag' => 'application.test'
} }
} }

View File

@ -2,5 +2,13 @@
type tail type tail
format json format json
path /var/log/test-application/*.json path /var/log/test-application/*.json
<parse>
type regexp
expression ^(?<name>[^ ]*) (?<user>[^ ]*) (?<age>\d*)$
</parse>
<storage>
type local
path test.pos
</storage>
tag application.test tag application.test
</source> </source>

View File

@ -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 |key2, val2| -%>
<%= key2 -%> <%= val2 %>
<%- end -%>
</<%= key %>>
<%- else -%>
<%= key -%> <%= val %> <%= key -%> <%= val %>
<%- end -%>
<% end -%> <% end -%>
</source> </source>