Showing with 57 additions and 22 deletions.
  1. +8 −2 CHANGELOG.md
  2. +7 −1 README.md
  3. +5 −5 manifests/config.pp
  4. +9 −5 manifests/init.pp
  5. +7 −2 manifests/params.pp
  6. +1 −1 metadata.json
  7. +20 −6 spec/classes/filebeat_spec.rb
10 changes: 8 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ Changelog
=========

## Unreleased
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v2.0.0...HEAD)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v2.1.0...HEAD)

## [v1.0.0](https://github.com/pcfens/puppet-filebeat/tree/v2.0.0)
## [v2.1.0](https://github.com/pcfens/puppet-filebeat/tree/v2.2.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v2.0.0...v2.1.0)

- Change beat_name configuration parameter to name [\#126](https://github.com/pcfens/puppet-filebeat/issues/126)
- Make configuration directory/file ownership configurable [\#127](https://github.com/pcfens/puppet-filebeat/issues/127)

## [v2.0.0](https://github.com/pcfens/puppet-filebeat/tree/v2.0.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v1.0.0...v2.0.0)

- Drop support for Puppet 3
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ but is expected to exist as a directory that puppet can write to.
### Processors

Filebeat 5.0 and greater includes a new libbeat feature for filtering and/or enhancing all
exported data through processors before geing sent to the configured output(s). They can be
exported data through processors before being sent to the configured output(s). They can be
defined as a hash added to the class declaration (also used for automatically creating
processors using hiera), or as their own defined resources.

Expand Down Expand Up @@ -233,7 +233,11 @@ Installs and configures filebeat.
that filebeat expects for your operating system.
- `config_dir`: [String] The directory where prospectors should be defined (default: /etc/filebeat/conf.d)
- `config_dir_mode`: [String] The permissions mode set on the configuration directory (default: 0755)
- `config_dir_owner`: [String] The owner of the configuration directory (default: root). Linux only.
- `config_dir_group`: [String] The group of the configuration directory (default: root). Linux only.
- `config_file_mode`: [String] The permissions mode set on configuration files (default: 0644)
- `config_file_owner`: [String] The owner of the configuration files, including prospectors (default: root). Linux only.
- `config_file_group`: [String] The group of the configuration files, including prospectors (default: root). Linux only.
- `purge_conf_dir`: [Boolean] Should files in the prospector configuration directory not managed by puppet be automatically purged
- `disable_config_test`: [Boolean] Disable configuration and prospector validation tests (default: false)
- `outputs`: [Hash] Will be converted to YAML for the required outputs section of the configuration (see documentation, and above)
Expand All @@ -250,6 +254,8 @@ Installs and configures filebeat.
- `max_procs`: [Number] The maximum number of CPUs that can be simultaneously used
- `fields`: [Hash] Optional fields that should be added to each event output
- `fields_under_root`: [Boolean] If set to true, custom fields are stored in the top level instead of under fields
- `disable_config_test`: [Boolean] If set to true, configuration tests won't be run on config files before writing them.
- `processors`: [Hash] Processors that should be configured.
- `prospectors`: [Hash] Prospectors that will be created. Commonly used to create prospectors using hiera

### Private Classes
Expand Down
10 changes: 5 additions & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class filebeat::config {
$filebeat_config = delete_undef_values({
'shutdown_timeout' => $filebeat::shutdown_timeout,
'beat_name' => $filebeat::beat_name,
'name' => $filebeat::beat_name,
'tags' => $filebeat::tags,
'queue_size' => $filebeat::queue_size,
'max_procs' => $filebeat::max_procs,
Expand Down Expand Up @@ -35,8 +35,8 @@
ensure => $filebeat::file_ensure,
path => $filebeat::config_file,
content => template($filebeat::conf_template),
owner => 'root',
group => 'root',
owner => $filebeat::config_file_owner,
group => $filebeat::config_file_group,
mode => $filebeat::config_file_mode,
validate_cmd => $validate_cmd,
notify => Service['filebeat'],
Expand All @@ -46,8 +46,8 @@
file {'filebeat-config-dir':
ensure => $filebeat::directory_ensure,
path => $filebeat::config_dir,
owner => 'root',
group => 'root',
owner => $filebeat::config_dir_owner,
group => $filebeat::config_dir_group,
mode => $filebeat::config_dir_mode,
recurse => $filebeat::purge_conf_dir,
purge => $filebeat::purge_conf_dir,
Expand Down
14 changes: 9 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
# @param max_procs [Integer] The maximum number of CPUs that can be simultaneously used
# @param fields [Hash] Optional fields that should be added to each event output
# @param fields_under_root [Boolean] If set to true, custom fields are stored in the top level instead of under fields
# @param processors [Array] Processors that will be added. Commonly used to create processors using hiera.
# @param processors [Hash] Processors that will be added. Commonly used to create processors using hiera.
# @param prospectors [Hash] Prospectors that will be created. Commonly used to create prospectors using hiera
# @param prospectors_merge [Boolean] Whether $prospectors should merge all hiera sources, or use simple automatic parameter lookup
# proxy_address [String] Proxy server to use for downloading files
Expand All @@ -55,27 +55,31 @@
Boolean $publish_async = $filebeat::params::publish_async,
String $registry_file = $filebeat::params::registry_file,
String $config_file = $filebeat::params::config_file,
Optional[String] $config_file_owner = $filebeat::params::config_file_owner,
Optional[String] $config_file_group = $filebeat::params::config_file_group,
String[4,4] $config_dir_mode = $filebeat::params::config_dir_mode,
String $config_dir = $filebeat::params::config_dir,
String[4,4] $config_file_mode = $filebeat::params::config_file_mode,
Optional[String] $config_dir_owner = $filebeat::params::config_dir_owner,
Optional[String] $config_dir_group = $filebeat::params::config_dir_group,
Boolean $purge_conf_dir = $filebeat::params::purge_conf_dir,
Hash $outputs = $filebeat::params::outputs,
Hash $shipper = $filebeat::params::shipper,
Hash $logging = $filebeat::params::logging,
Hash $run_options = $filebeat::params::run_options,
String $conf_template = $filebeat::params::conf_template,
Optional[Pattern[/^(http(?:s)?\:\/\/[a-zA-Z0-9]+(?:(?:\.|\-)[a-zA-Z0-9]+)+(?:\:\d+)?(?:\/[\w\-]+)*(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$/]] $download_url = undef,
Optional[String] $install_dir = $filebeat::params::install_dir,
Optional[String] $install_dir = $filebeat::params::install_dir,
String $tmp_dir = $filebeat::params::tmp_dir,
Integer $shutdown_timeout = $filebeat::params::shutdown_timeout,
String $beat_name = $filebeat::params::beat_name,
Array $tags = $filebeat::params::tags,
Integer $queue_size = $filebeat::params::queue_size,
Optional[Integer] $max_procs = $filebeat::params::max_procs,
Hash $fields = $filebeat::params::fields,
Optional[Integer] $max_procs = $filebeat::params::max_procs,
Hash $fields = $filebeat::params::fields,
Boolean $fields_under_root = $filebeat::params::fields_under_root,
Boolean $disable_config_test = $filebeat::params::disable_config_test,
Array[Hash] $processors = [],
Hash $processors = {},
Hash $prospectors = {},
Optional[Pattern[/^(http(?:s)?\:\/\/[a-zA-Z0-9]+(?:(?:\.|\-)[a-zA-Z0-9]+)+(?:\:\d+)?(?:\/[\w\-]+)*(?:\/?|\/\w+\.[a-zA-Z]{2,4}(?:\?[\w]+\=[\w\-]+)?)?(?:\&[\w]+\=[\w\-]+)*)$/]] $proxy_address = undef
) inherits filebeat::params {
Expand Down
9 changes: 7 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
$tags = []
$queue_size = 1000
$max_procs = undef
$config_dir_mode = '0755'
$config_file_mode = '0644'
$config_dir_mode = '0755'
$purge_conf_dir = true
$fields = {}
$fields_under_root = false
Expand All @@ -23,6 +23,11 @@
$conf_template = "${module_name}/pure_hash.yml.erb"
$disable_config_test = false

$config_file_owner = 'root'
$config_file_group = 'root'
$config_dir_owner = 'root'
$config_dir_group = 'root'

case $::kernel {
'Linux' : {
$package_ensure = present
Expand All @@ -45,7 +50,7 @@
}

'Windows' : {
$package_ensure = '5.1.1'
$package_ensure = '5.5.2'
$config_file = 'C:/Program Files/Filebeat/filebeat.yml'
$config_dir = 'C:/Program Files/Filebeat/conf.d'
$registry_file = 'C:/ProgramData/filebeat/registry'
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pcfens-filebeat",
"version": "2.0.0",
"version": "2.1.0",
"author": "pcfens",
"license": "Apache-2.0",
"summary": "A module to install and manage the filebeat log shipper",
Expand Down
26 changes: 20 additions & 6 deletions spec/classes/filebeat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe 'filebeat', type: :class do
[
nil,
'5.1.1'
'5.5.2'
].each do |filebeat_vers|
context "on a system with filebeat #{filebeat_vers} installed" do
let :facts do
Expand Down Expand Up @@ -116,6 +116,13 @@
it { is_expected.to contain_anchor('filebeat::begin') }
it { is_expected.to contain_anchor('filebeat::end') }
it { is_expected.to contain_class('filebeat::install') }

it { is_expected.to contain_archive('C:/Windows/Temp/filebeat-5.5.2-windows-x86_64.zip') }
it { is_expected.to contain_exec('rename filebeat-5.5.2-windows-x86_64') }
it { is_expected.to contain_exec('unzip filebeat-5.5.2-windows-x86_64') }
it { is_expected.to contain_exec('install filebeat-5.5.2-windows-x86_64') }
it { is_expected.to contain_exec('mark filebeat-5.5.2-windows-x86_64') }

it { is_expected.to contain_class('filebeat::config') }
it { is_expected.to contain_anchor('filebeat::install::begin') }
it { is_expected.to contain_anchor('filebeat::install::end') }
Expand Down Expand Up @@ -150,7 +157,7 @@
lsbdistrelease: '16.04',
rubyversion: '1.9.3',
puppetversion: Puppet.version,
filebeat_version: '5.2.2'
filebeat_version: '5.5.2'
}
end

Expand Down Expand Up @@ -188,7 +195,7 @@
osfamily: 'RedHat',
rubyversion: '1.8.7',
puppetversion: Puppet.version,
filebeat_version: '5.2.2'
filebeat_version: '5.5.2'
}
end

Expand Down Expand Up @@ -218,7 +225,7 @@
lsbdistrelease: '16.04',
rubyversion: '1.9.3',
puppetversion: Puppet.version,
filebeat_version: '5.2.2'
filebeat_version: '5.5.2'
}
end

Expand Down Expand Up @@ -282,7 +289,7 @@
osfamily: 'RedHat',
rubyversion: '1.8.7',
puppetversion: Puppet.version,
filebeat_version: '5.2.2'
filebeat_version: '5.5.2'
}
end

Expand Down Expand Up @@ -318,7 +325,7 @@
architecture: 'x64',
rubyversion: '1.9.3',
puppetversion: Puppet.version,
filebeat_version: '5.2.2'
filebeat_version: '5.5.2'
}
end

Expand All @@ -327,6 +334,13 @@
it { is_expected.to contain_anchor('filebeat::begin') }
it { is_expected.to contain_anchor('filebeat::end') }
it { is_expected.to contain_class('filebeat::install') }

it { is_expected.to contain_archive('C:/Windows/Temp/filebeat-absent-windows-x86_64.zip') }
it { is_expected.to contain_exec('rename filebeat-absent-windows-x86_64') }
it { is_expected.to contain_exec('unzip filebeat-absent-windows-x86_64') }
it { is_expected.to contain_exec('install filebeat-absent-windows-x86_64') }
it { is_expected.to contain_exec('mark filebeat-absent-windows-x86_64') }

it { is_expected.to contain_class('filebeat::config') }
it { is_expected.to contain_anchor('filebeat::install::begin') }
it { is_expected.to contain_anchor('filebeat::install::end') }
Expand Down