Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ fluent_bit::configs:
service: 'INPUT'
name: 'cpu'
tag: 'tag1'

# optional custom parsers configuration
fluent_bit::parsers:
parser_01:
service: 'PARSER'
name: 'parser_01'
format: 'regex'
regex: '^(?<time>[^ ]*) (?<message>[^$]*)$'
time_key: 'time'
time_format: '%Y-%m-%dT%H:%M:%S,%L'
```

## Limitations
Expand Down
2 changes: 1 addition & 1 deletion lib/fluent_bit/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def render(c)
c.select{ |e| e !="service" }
.map { |k, v|
key = k.strip.downcase
value = v.strip.downcase
value = v
padding = 15 - key.length
padding = padding < 1 ? 1 : padding
" " << key << " "*padding << value}
Expand Down
18 changes: 18 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,22 @@
require => Class['Fluent_bit::Install'],
notify => Class['Fluent_bit::Service'],
}

if ( $fluent_bit::parsers != {} ) {
file { $fluent_bit::parsers_file:
ensure => present,
content => fluent_bit_config($fluent_bit::parsers),
owner => $fluent_bit::config_owner,
group => $fluent_bit::config_group,
mode => '0644',
require => File[$fluent_bit::config_file],
notify => Class['Fluent_bit::Service'],
}
} else {
file { $fluent_bit::parsers_file:
ensure => absent,
notify => Class['Fluent_bit::Service'],
}
}

}
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
String $config_owner = $::fluent_bit::params::config_owner,
String $config_group = $::fluent_bit::params::config_group,
Hash $configs = $::fluent_bit::params::configs,
Optional[String] $parsers_file = $::fluent_bit::params::parsers_file,
Optional[Hash] $parsers = $::fluent_bit::params::parsers,
) inherits fluent_bit::params {
contain fluent_bit::install
contain fluent_bit::config
Expand Down
3 changes: 3 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@
$config_owner = 'root'
$config_group = 'root'
$configs = {}

$parsers_file = '/etc/td-agent-bit/parsers-smx.conf'
$parsers = {}
}