Skip to content

Commit

Permalink
add support for features config section (#334)
Browse files Browse the repository at this point in the history
* add support for features config section

* add support for features config section

---------

Co-authored-by: Guillaume Nobiron <[email protected]>
  • Loading branch information
gnobironts and Guillaume Nobiron authored Sep 11, 2023
1 parent 4cc5297 commit 363adaa
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
50 changes: 37 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,19 +248,42 @@ filebeat::setup:
```

## Reference
- [**Public Classes**](#public-classes)
- [Class: filebeat](#class-filebeat)
- [**Private Classes**](#private-classes)
- [Class: filebeat::config](#class-filebeatconfig)
- [Class: filebeat::install](#class-filebeatinstall)
- [Class: filebeat::params](#class-filebeatparams)
- [Class: filebeat::repo](#class-filebeatrepo)
- [Class: filebeat::service](#class-filebeatservice)
- [Class: filebeat::install::linux](#class-filebeatinstalllinux)
- [Class: filebeat::install::windows](#class-filebeatinstallwindows)
- [**Public Defines**](#public-defines)
- [Define: filebeat::input](#define-filebeatinput)
- [Define: filebeat::processors](#define-filebeatprocessor)
- [puppet-filebeat](#puppet-filebeat)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Setup](#setup)
- [What filebeat affects](#what-filebeat-affects)
- [Upgrading to Filebeat 7.x](#upgrading-to-filebeat-7x)
- [Setup Requirements](#setup-requirements)
- [Beginning with filebeat](#beginning-with-filebeat)
- [Usage](#usage)
- [Adding an Input](#adding-an-input)
- [Multiline Logs](#multiline-logs)
- [JSON Logs](#json-logs)
- [Inputs in Hiera](#inputs-in-hiera)
- [Usage on Windows](#usage-on-windows)
- [Processors](#processors)
- [Processors in Hiera](#processors-in-hiera)
- [Index Lifecycle Management](#index-lifecycle-management)
- [Reference](#reference)
- [Public Classes](#public-classes)
- [Class: `filebeat`](#class-filebeat)
- [Private Classes](#private-classes)
- [Class: `filebeat::config`](#class-filebeatconfig)
- [Class: `filebeat::install`](#class-filebeatinstall)
- [Class: `filebeat::params`](#class-filebeatparams)
- [Class: `filebeat::repo`](#class-filebeatrepo)
- [Class: `filebeat::service`](#class-filebeatservice)
- [Class: `filebeat::install::linux`](#class-filebeatinstalllinux)
- [Class: `filebeat::install::windows`](#class-filebeatinstallwindows)
- [Public Defines](#public-defines)
- [Define: `filebeat::input`](#define-filebeatinput)
- [Limitations](#limitations)
- [Generic template](#generic-template)
- [Debian Systems](#debian-systems)
- [Using config\_file](#using-config_file)
- [Logging on systems with Systemd and with version filebeat 7.0+ installed](#logging-on-systems-with-systemd-and-with-version-filebeat-70-installed)
- [Development](#development)

### Public Classes

Expand Down Expand Up @@ -297,6 +320,7 @@ Installs and configures filebeat.
- `enable_conf_modules`: [Boolean] Should filebeat.config.modules be enabled
- `modules_dir`: [String] The directory where module configurations should be defined (default: /etc/filebeat/modules.d)
- `cloud`: [Hash] Will be converted to YAML for the optional cloud.id and cloud.auth of the configuration (see documentation, and above)
- `features`: [Hash] Will be converted to YAML for the optional features section of the configuration (see documentation, and above)
- `queue`: [Hash] Will be converted to YAML for the optional queue.mem and queue.disk of the configuration (see documentation, and above)
- `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)
Expand Down
12 changes: 10 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,19 @@
})
# Add the 'xpack' section if supported (version >= 6.1.0) and not undef
if $filebeat::xpack and versioncmp($filebeat::package_ensure, '6.1.0') >= 0 {
$filebeat_config = deep_merge($filebeat_config_temp, { 'xpack' => $filebeat::xpack })
$filebeat_config_xpack = deep_merge($filebeat_config_temp, { 'xpack' => $filebeat::xpack })
}
else {
$filebeat_config = $filebeat_config_temp
$filebeat_config_xpack = $filebeat_config_temp
}
# Add the 'features' section if supported (version >= 8.7.0) and not undef
if $filebeat::features and versioncmp($filebeat::package_ensure, '8.7.0') >= 0 {
$filebeat_config = deep_merge($filebeat_config_xpack, { 'features' => $filebeat::features })
}
else {
$filebeat_config = $filebeat_config_xpack
}

} else {
$filebeat_config_temp = delete_undef_values({
'shutdown_timeout' => $filebeat::shutdown_timeout,
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# @param modules_dir [String] The directory where module configurations should be defined (default: /etc/filebeat/modules.d)
# @param http [Hash] A hash of the http section of configuration
# @param cloud [Hash] Will be converted to YAML for the optional cloud of the configuration (see documentation, and above)
# @param features [Hash] Will be converted to YAML to create the optional features section of the filebeat config (see documentation)
# @param queue [Hash] Will be converted to YAML for the optional queue of the configuration (see documentation, and above)
# @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)
Expand Down Expand Up @@ -91,6 +92,7 @@
Boolean $enable_conf_modules = $filebeat::params::enable_conf_modules,
Hash $http = $filebeat::params::http,
Hash $cloud = $filebeat::params::cloud,
Hash $features = $filebeat::params::features,
Hash $queue = $filebeat::params::queue,
Hash $outputs = $filebeat::params::outputs,
Hash $shipper = $filebeat::params::shipper,
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 @@
$ssl = {}
$http = {}
$cloud = {}
$features = {}
$queue = {}
$outputs = {}
$shipper = {}
Expand Down

0 comments on commit 363adaa

Please sign in to comment.