Showing with 48 additions and 3 deletions.
  1. +9 −0 CHANGELOG.md
  2. +23 −0 README.md
  3. +2 −2 manifests/config.pp
  4. +5 −0 manifests/init.pp
  5. +2 −0 manifests/params.pp
  6. +1 −1 metadata.json
  7. +6 −0 templates/filebeat.yml.ruby18.erb
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Changelog
## Unreleased
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v0.7.0...HEAD)

## [v0.7.1](https://github.com/pcfens/puppet-filebeat/tree/v0.7.1)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v0.7.0...v0.7.1)

- Allow the config file to be written to an alternate location. Be sure and read limitations before you use this.

**Fixed Bugs**
- Add elasticsearch and logstash port setting to Ruby 1.8 template
[\#29](https://github.com/pcfens/puppet-filebeat/issues/29)

## [v0.7.0](https://github.com/pcfens/puppet-filebeat/tree/v0.7.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v0.6.3...v0.7.0)

Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- [Public Defines](#public-defines)
5. [Limitations - OS compatibility, etc.](#limitations)
- [Pre-1.9.1 Ruby](#pre-191-ruby)
- [Using config_file](#using-config_file)
6. [Development - Guide for contributing to the module](#development)

## Description
Expand Down Expand Up @@ -159,6 +160,9 @@ Installs and configures filebeat.
- `idle_timeout`: [String] How often the spooler should be flushed even if spool size isn't reached (default: 5s)
- `publish_async`: [Boolean] If set to true filebeat will publish while preparing the next batch of lines to transmit (defualt: false)
- `registry_file`: [String] The registry file used to store positions, absolute or relative to working directory (default .filebeat)
- `config_file`: [String] Where the configuration file managed by this module should be placed. If you think
you might want to use this, read the [limitations](#using-config_file) first. Defaults to the location
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_file_mode`: [String] The permissions mode set on configuration files (default: 0644)
Expand Down Expand Up @@ -271,6 +275,25 @@ parameter to 'filebeat/filebeat.yml.erb'.
See [templates/filebeat.yml.ruby18.erb](https://github.com/pcfens/puppet-filebeat/blob/master/templates/filebeat.yml.ruby18.erb)
for the all of the details.

### Using config_file
There are a few very specific use cases where you don't want this module to directly manage the filebeat
configuration file, but you still want the configuration file on the system at a different location.
Setting `config_file` will write the filebeat configuration file to an alternate location, but it will not
update the init script. If you don't also manage the correct file (/etc/filebeat/filebeat.yml on Linux,
C:/Program Files/Filebeat/filebeat.yml on Windows) then filebeat won't be able to start.

If you're copying the alternate config file location into the real location you'll need to include some
metaparameters like
```puppet
file { '/etc/filebeat/filebeat.yml':
ensure => file,
source => 'file:///etc/filebeat/filebeat.special',
require => File['filebeat.yml'],
notify => Service['filebeat'],
}
```
to ensure that services are managed like you might expect.

## Development

Pull requests and bug reports are welcome. If you're sending a pull request, please consider
Expand Down
4 changes: 2 additions & 2 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
'Linux' : {
file {'filebeat.yml':
ensure => file,
path => '/etc/filebeat/filebeat.yml',
path => $filebeat::config_file,
content => template($filebeat::conf_template),
owner => 'root',
group => 'root',
Expand All @@ -39,7 +39,7 @@
'Windows' : {
file {'filebeat.yml':
ensure => file,
path => 'C:/Program Files/Filebeat/filebeat.yml',
path => $filebeat::config_file,
content => template($filebeat::conf_template),
notify => Service['filebeat'],
}
Expand Down
5 changes: 5 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
$idle_timeout = $filebeat::params::idle_timeout,
$publish_async = $filebeat::params::publish_async,
$registry_file = $filebeat::params::registry_file,
$config_file = $filebeat::params::config_file,
$config_dir = $filebeat::params::config_dir,
$config_dir_mode = $filebeat::params::config_dir_mode,
$config_file_mode = $filebeat::params::config_file_mode,
Expand All @@ -69,6 +70,10 @@
$prospectors_final = $prospectors
}

if $config_file != $filebeat::params::config_file {
warning('You\'ve specified a non-standard config_file location - filebeat may fail to start unless you\'re doing something to fix this')
}

validate_hash($outputs, $logging, $prospectors_final)
validate_string($idle_timeout, $registry_file, $config_dir, $package_ensure)

Expand Down
2 changes: 2 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

case $::kernel {
'Linux' : {
$config_file = '/etc/filebeat/filebeat.yml'
$config_dir = '/etc/filebeat/conf.d'

# These parameters are ignored if/until tarball installs are supported in Linux
Expand All @@ -40,6 +41,7 @@
}

'Windows' : {
$config_file = 'C:/Program Files/Filebeat/filebeat.yml'
$config_dir = 'C:/Program Files/Filebeat/conf.d'
$download_url = 'https://download.elastic.co/beats/filebeat/filebeat-1.2.3-windows.zip'
$install_dir = 'C:/Program Files'
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": "0.7.0",
"version": "0.7.1",
"author": "pcfens",
"license": "Apache-2.0",
"summary": "A module to install and manage the filebeat log shipper",
Expand Down
6 changes: 6 additions & 0 deletions templates/filebeat.yml.ruby18.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<%- @filebeat_config['output']['elasticsearch']['hosts'].each do |host| -%>
- <%= host %>
<%- end -%>
<%- if @filebeat_config['output']['elasticsearch']['port'] != nil -%>
port: <%= @filebeat_config['output']['elasticsearch']['port'] %>
<%- end -%>
<%- if @filebeat_config['output']['elasticsearch']['protocol'] != nil -%>
protocol: "<%= @filebeat_config['output']['elasticsearch']['protocol'] %>"
<%- end -%>
Expand Down Expand Up @@ -110,6 +113,9 @@
<%- @filebeat_config['output']['logstash']['hosts'].each do |host| -%>
- <%= host %>
<%- end -%>
<%- if @filebeat_config['output']['logstash']['port'] != nil -%>
port: <%= @filebeat_config['output']['logstash']['port'] %>
<%- end -%>
<%- if @filebeat_config['output']['logstash']['worker'] != nil -%>
worker: <%= @filebeat_config['output']['logstash']['worker'] %>
<%- end -%>
Expand Down