Skip to content

Commit

Permalink
proposal to add an array parameter to manage the filebeat modules (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
ml14tlc authored and pcfens committed May 23, 2018
1 parent 9e247a5 commit ef7c703
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Installs and configures filebeat.
- `outputs`: [Hash] Will be converted to YAML for the required outputs section of the configuration (see documentation, and above)
- `shipper`: [Hash] Will be converted to YAML to create the optional shipper section of the filebeat config (see documentation)
- `logging`: [Hash] Will be converted to YAML to create the optional logging section of the filebeat config (see documentation)
- `modules`: [Array] Will be converted to YAML to create the optional modules section of the filebeat config (see documentation)
- `conf_template`: [String] The configuration template to use to generate the main filebeat.yml config file.
- `download_url`: [String] The URL of the zip file that should be downloaded to install filebeat (windows only)
- `install_dir`: [String] Where filebeat should be installed (windows only)
Expand Down
10 changes: 9 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'path' => "${filebeat::config_dir}/*.yml",
},
'shutdown_timeout' => $filebeat::shutdown_timeout,
'modules' => $filebeat::modules,
},
'output' => $filebeat::outputs,
'shipper' => $filebeat::shipper,
Expand All @@ -30,7 +31,7 @@
'setup' => $filebeat::setup,
})
} else {
$filebeat_config = delete_undef_values({
$filebeat_config_temp = delete_undef_values({
'shutdown_timeout' => $filebeat::shutdown_timeout,
'name' => $filebeat::beat_name,
'tags' => $filebeat::tags,
Expand All @@ -52,6 +53,13 @@
'runoptions' => $filebeat::run_options,
'processors' => $filebeat::processors,
})
# Add the 'modules' section if supported (version >= 5.2.0)
if versioncmp($filebeat::package_ensure, '5.2.0') >= 0 {
$filebeat_config = deep_merge($filebeat_config_temp, {'modules' => $filebeat::modules})
}
else {
$filebeat_config = $filebeat_config_temp
}
}

if $::filebeat_version {
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# @param outputs [Hash] Will be converted to YAML for the required outputs section of the configuration (see documentation, and above)
# @param shipper [Hash] Will be converted to YAML to create the optional shipper section of the filebeat config (see documentation)
# @param logging [Hash] Will be converted to YAML to create the optional logging section of the filebeat config (see documentation)
# @param modules [Array] Will be converted to YAML to create the optional modules section of the filebeat config (see documentation)
# @param conf_template [String] The configuration template to use to generate the main filebeat.yml config file
# @param download_url [String] The URL of the zip file that should be downloaded to install filebeat (windows only)
# @param install_dir [String] Where filebeat should be installed (windows only)
Expand Down Expand Up @@ -85,6 +86,7 @@
Array $processors = [],
Hash $prospectors = {},
Hash $setup = {},
Array $modules = [],
Optional[Variant[Stdlib::HTTPUrl, Stdlib::HTTPSUrl]] $proxy_address = undef, # lint:ignore:140chars
Stdlib::Absolutepath $filebeat_path = $filebeat::params::filebeat_path
) inherits filebeat::params {
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$shipper = {}
$logging = {}
$run_options = {}
$modules = []
$kernel_fail_message = "${::kernel} is not supported by filebeat."
$osfamily_fail_message = "${::osfamily} is not supported by filebeat."
$conf_template = "${module_name}/pure_hash.yml.erb"
Expand Down

0 comments on commit ef7c703

Please sign in to comment.