mirror of
https://github.com/krislamo/puppet-fluentd
synced 2024-11-09 20:50:34 +00:00
Implemented <parse>, <storage> etc sections within fluentd::source template
- Changed templates/source.erb to accept Hash elements within 'config' - Updated source_spec test - Updated README.md
This commit is contained in:
parent
3c537f0ff5
commit
72e6bcd744
16
README.md
16
README.md
@ -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>
|
||||||
```
|
```
|
||||||
|
@ -5,6 +5,14 @@
|
|||||||
'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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
8
spec/fixtures/files/source_tail.conf
vendored
8
spec/fixtures/files/source_tail.conf
vendored
@ -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>
|
||||||
|
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user