Showing with 65 additions and 28 deletions.
  1. +7 −2 CHANGELOG.md
  2. +26 −10 README.md
  3. +4 −1 lib/facter/filebeat_version.rb
  4. +4 −1 manifests/config.pp
  5. +14 −5 manifests/init.pp
  6. +4 −1 manifests/input.pp
  7. +0 −1 manifests/install.pp
  8. +1 −3 manifests/install/freebsd.pp
  9. +4 −3 manifests/params.pp
  10. +1 −1 metadata.json
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@ Changelog
=========

## Unreleased
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.9.0...HEAD)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.10.0...HEAD)

## [v4.10.0](https://github.com/pcfens/puppet-filebeat/tree/v4.10.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.9.0...v4.10.0)

- Add a parameter to skip managing the filebeat package [\#281](https://github.com/pcfens/puppet-filebeat/pull/281)
- Improve FreeBSD Support [\#282](https://github.com/pcfens/puppet-filebeat/pull/282)

## [v4.9.0](https://github.com/pcfens/puppet-filebeat/tree/v4.9.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v4.8.0...v4.9.0)


- Make pipeline available in all inputs [\#275](https://github.com/pcfens/puppet-filebeat/pull/275)
- Support autodiscovery [\#278](https://github.com/pcfens/puppet-filebeat/pull/278)
- Support `close_timeout` as a string [\#279](https://github.com/pcfens/puppet-filebeat/pull/279)
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,42 @@

#### Table of Contents

1. [Description](#description)
2. [Setup - The basics of getting started with filebeat](#setup)
- [puppet-filebeat](#puppet-filebeat)
- [Table of Contents](#table-of-contents)
- [Description](#description)
- [Setup](#setup)
- [What filebeat affects](#what-filebeat-affects)
- [Setup requirements](#setup-requirements)
- [Upgrading to Filebeat 7.x](#upgrading-to-filebeat-7x)
- [Setup Requirements](#setup-requirements)
- [Beginning with filebeat](#beginning-with-filebeat)
3. [Usage - Configuration options and additional functionality](#usage)
- [Usage](#usage)
- [Adding an Input](#adding-an-input)
- [Multiline Logs](#multiline-logs)
- [JSON logs](#json-logs)
- [Inputs in hiera](#inputs-in-hiera)
- [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)
4. [Reference](#reference)
- [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)
5. [Limitations - OS compatibility, etc.](#limitations)
- [Pre-1.9.1 Ruby](#pre-191-ruby)
- [Define: `filebeat::input`](#define-filebeatinput)
- [Limitations](#limitations)
- [Generic template](#generic-template)
- [Debian Systems](#debian-systems)
- [Using config_file](#using-config_file)
6. [Development - Guide for contributing to the module](#development)
- [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)

## Description

Expand Down Expand Up @@ -254,6 +269,7 @@ Installs and configures filebeat.
- `package_ensure`: [String] The ensure parameter for the filebeat package If set to absent,
inputs and processors passed as parameters are ignored and everything managed by
puppet will be removed. (default: present)
- `manage_package`: [Boolean] Whether ot not to manage the installation of the package (default: true)
- `manage_repo`: [Boolean] Whether or not the upstream (elastic) repo should be configured or not (default: true)
- `major_version`: [Enum] The major version of Filebeat to install. Should be either `'5'` or `'6'`. The default value is `'6'`, except
for OpenBSD 6.3 and earlier, which has a default value of `'5'`.
Expand Down
5 changes: 4 additions & 1 deletion lib/facter/filebeat_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
elsif File.executable?('/usr/share/filebeat/bin/filebeat')
filebeat_version = Facter::Util::Resolution.exec('/usr/share/filebeat/bin/filebeat --version')
elsif File.executable?('/usr/local/sbin/filebeat')
filebeat_version = Facter::Util::Resolution.exec('/usr/local/sbin/filebeat --version')
filebeat_version = Facter::Util::Resolution.exec('/usr/local/sbin/filebeat version')
if filebeat_version.empty?
filebeat_version = Facter::Util::Resolution.exec('/usr/local/sbin/filebeat --version')
end
elsif File.exist?('c:\Program Files\Filebeat\filebeat.exe')
filebeat_version = Facter::Util::Resolution.exec('"c:\Program Files\Filebeat\filebeat.exe" version')
if filebeat_version.empty?
Expand Down
5 changes: 4 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@
'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => '/usr/local/sbin/filebeat ${filebeat::extra_validate_options} -N -configtest -c %',
default => $major_version ? {
'5' => "/usr/local/sbin/filebeat ${filebeat::extra_validate_options} -N -configtest -c %",
default => "/usr/local/sbin/filebeat ${filebeat::extra_validate_options} -c % test config",
},
}

file {'filebeat.yml':
Expand Down
19 changes: 14 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# }
#
# @param package_ensure [String] The ensure parameter for the filebeat package (default: present)
# @param manage_package [Boolean] Whether ot not to manage the installation of the package (default: true)
# @param manage_repo [Boolean] Whether or not the upstream (elastic) repo should be configured or not (default: true)
# @param manage_apt [Boolean] Whether or not the apt class should be explicitly called or not (default: true)
# @param major_version [Enum] The major version of Filebeat to be installed.
Expand Down Expand Up @@ -53,6 +54,7 @@
# @param autodiscover [Hash] Will be converted to YAML for the optional autodiscover section of the configuration (see documentation, and above)
class filebeat (
String $package_ensure = $filebeat::params::package_ensure,
Boolean $manage_package = $filebeat::params::manage_package,
Boolean $manage_repo = $filebeat::params::manage_repo,
Boolean $manage_apt = $filebeat::params::manage_apt,
Enum['5','6', '7'] $major_version = $filebeat::params::major_version,
Expand Down Expand Up @@ -145,11 +147,18 @@
-> class { '::filebeat::service': }
-> anchor { 'filebeat::end': }
} else {
anchor { 'filebeat::begin': }
-> class { '::filebeat::install': }
-> class { '::filebeat::config': }
-> class { '::filebeat::service': }
-> anchor { 'filebeat::end': }
if !$manage_package {
anchor { 'filebeat::begin': }
-> class { '::filebeat::config': }
-> class { '::filebeat::service': }
-> anchor { 'filebeat::end': }
} else {
anchor { 'filebeat::begin': }
-> class { '::filebeat::install': }
-> class { '::filebeat::config': }
-> class { '::filebeat::service': }
-> anchor { 'filebeat::end': }
}
}

if $package_ensure != 'absent' {
Expand Down
5 changes: 4 additions & 1 deletion manifests/input.pp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@
'FreeBSD' : {
$validate_cmd = ($filebeat::disable_config_test or $skip_validation) ? {
true => undef,
default => '/usr/local/sbin/filebeat -N -configtest -c %',
default => $filebeat::major_version ? {
'5' => "/usr/local/sbin/filebeat -N -configtest -c %",
default => "/usr/local/sbin/filebeat -c ${filebeat::config_file} test config",
},
}
file { "filebeat-${name}":
ensure => $ensure,
Expand Down
1 change: 0 additions & 1 deletion manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,4 @@
}

anchor { 'filebeat::install::end': }

}
4 changes: 1 addition & 3 deletions manifests/install/freebsd.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
# @summary A simple class to install the filebeat package
#
class filebeat::install::freebsd {

# filebeat, heartbeat, metricbeat, packetbeat are all contained in a
# single FreeBSD Package (see https://www.freshports.org/sysutils/beats/ )
ensure_packages (['beats'], {ensure => $filebeat::package_ensure})

ensure_packages (["beats${filebeat::major_version}"], {ensure => $filebeat::package_ensure})
}
7 changes: 4 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# @summary Set a bunch of default parameters
class filebeat::params {
$manage_package = true
$service_ensure = running
$service_enable = true
$spool_size = 2048
Expand Down Expand Up @@ -96,13 +97,13 @@

'FreeBSD': {
$package_ensure = present
$config_file = '/usr/local/etc/filebeat.yml'
$config_dir = '/usr/local/etc/filebeat.d'
$config_file = '/usr/local/etc/beats/filebeat.yml'
$config_dir = '/usr/local/etc/beats/filebeat.d'
$config_file_owner = 'root'
$config_file_group = 'wheel'
$config_dir_owner = 'root'
$config_dir_group = 'wheel'
$modules_dir = '/usr/local/etc/filebeat.modules.d'
$modules_dir = '/usr/local/etc/beats/filebeat.modules.d'
$tmp_dir = '/tmp'
$service_provider = undef
$install_dir = undef
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": "4.9.0",
"version": "4.10.0",
"author": "pcfens",
"summary": "A module to install and manage the filebeat log shipper",
"license": "Apache-2.0",
Expand Down