Showing with 86 additions and 21 deletions.
  1. +1 −1 .fixtures.yml
  2. +8 −1 CHANGELOG.md
  3. +7 −2 README.md
  4. +5 −0 manifests/prospector.pp
  5. +4 −4 metadata.json
  6. +47 −11 spec/defines/prospector_spec.rb
  7. +14 −2 templates/prospector.yml.erb
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fixtures:
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
apt:
repo: "https://github.com/puppetlabs/puppetlabs-apt.git"
ref: '4.2.0'
ref: '6.0.0'
powershell: "https://github.com/puppetlabs/puppetlabs-powershell.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
symlinks:
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ Changelog
=========

## Unreleased
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v3.2.2...HEAD)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v3.3.0...HEAD)

## [v3.3.0](https://github.com/pcfens/puppet-filebeat/tree/v3.3.0)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v3.2.2...v3.3.0)

- Allow use of puppet/archive 3.x [\#190](https://github.com/pcfens/puppet-filebeat/pull/190)
- Add support for Docker inputs [\#191](https://github.com/pcfens/puppet-filebeat/pull/191)
- Support puppetlabs/stdlib 5.x

## [v3.2.2](https://github.com/pcfens/puppet-filebeat/tree/v3.2.2)
[Full Changelog](https://github.com/pcfens/puppet-filebeat/compare/v3.2.1...v3.2.2)
Expand Down
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,15 @@ to fully understand what these parameters do.

**Parameters for `filebeat::prospector`**
- `ensure`: The ensure parameter on the prospector configuration file. (default: present)
- `paths`: [Array] The paths, or blobs that should be handled by the prospector. (required)
- `paths`: [Array] The paths, or blobs that should be handled by the prospector. (required only if input_type is not _docker_)
- `containers_ids`: [Array] If input_type is _docker_, the list of Docker container ids to read the logs from. (default: '*')
- `containers_path`: [String] If input_type is _docker_, the path from where the logs should be read from. (default: /var/log/docker/containers)
- `containers_stream`: [String] If input_type is _docker_, read from the specified stream only. (default: all)
- `combine_partial`: [Boolean] If input_type is _docker_, enable partial messages joining. (default: false)
- `cri_parse_flags`: [Boolean] If input_type is _docker_, enable CRI flags parsing from the log file. (default: false)
- `exclude_files`: [Array] Files that match any regex in the list are excluded from filebeat (default: [])
- `encoding`: [String] The file encoding. (default: plain)
- `input_type`: [String] log or stdin - where filebeat reads the log from (default:log)
- `input_type`: [String] log, docker or stdin - where filebeat reads the log from (default:log)
- `fields`: [Hash] Optional fields to add information to the output (default: {})
- `fields_under_root`: [Boolean] Should the `fields` parameter fields be stored at the top level of indexed documents.
- `ignore_older`: [String] Files older than this field will be ignored by filebeat (default: ignore nothing)
Expand Down
5 changes: 5 additions & 0 deletions manifests/prospector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
Enum['absent', 'present'] $ensure = present,
Array[String] $paths = [],
Array[String] $exclude_files = [],
Array[String] $containers_ids = ['\'*\''],
String $containers_path = '/var/lib/docker/containers',
String $containers_stream = 'all',
Boolean $combine_partial = false,
Boolean $cri_parse_flags = false,
String $encoding = 'plain',
String $input_type = 'log',
Hash $fields = {},
Expand Down
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pcfens-filebeat",
"version": "3.2.2",
"version": "3.3.0",
"author": "pcfens",
"summary": "A module to install and manage the filebeat log shipper",
"license": "Apache-2.0",
Expand All @@ -10,19 +10,19 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">=4.13.0 <5.0.0"
"version_requirement": ">=4.13.0 < 6.0.0"
},
{
"name": "puppetlabs/apt",
"version_requirement": ">=2.0.0 <7.0.0"
"version_requirement": ">=2.0.0 < 7.0.0"
},
{
"name": "puppetlabs/powershell",
"version_requirement": ">= 1.0.1 < 3.0.0"
},
{
"name": "puppet/archive",
"version_requirement": ">= 0.5.0 < 3.0.0"
"version_requirement": ">= 0.5.0 < 4.0.0"
}
],
"operatingsystem_support": [
Expand Down
58 changes: 47 additions & 11 deletions spec/defines/prospector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
}'
end
let(:title) { 'test-logs' }
let(:params) do
{
'paths' => [
'/var/log/auth.log',
'/var/log/syslog',
],
'doc_type' => 'syslog-beat',
}
end
on_supported_os(facterversion: '2.4').each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
let(:title) { 'test-logs' }
let(:params) do
{
'paths' => [
'/var/log/auth.log',
'/var/log/syslog',
],
'doc_type' => 'syslog-beat',
}
end
if os_facts[:kernel] != 'windows'
it { is_expected.to compile }
end
Expand All @@ -38,9 +38,45 @@
)
}
end
context "with docker input support on #{os}" do
let(:facts) { os_facts }
# Docker Support
let(:title) { 'docker' }
let(:params) do
{
'input_type' => 'docker',
}
end
if os_facts[:kernel] != 'windows'
it { is_expected.to compile }
end
it {
is_expected.to contain_file('filebeat-docker').with(
notify: 'Service[filebeat]',
)
is_expected.to contain_file('filebeat-docker').with_content(
%r{- type: docker\n\s{2}containers:\n\s{4}ids:\n\s{4}- '\*'\n\s{4}path: /var/lib/docker/containers\n\s{4}stream: all\n\s{2}combine_partial: false\n\s{2}cri.parse_flags: false\n},
)
}
end
end
context 'with no parameters' do
let(:title) { 'test-logs' }
let(:params) do
{
'paths' => [
'/var/log/auth.log',
'/var/log/syslog',
],
'doc_type' => 'syslog-beat',
}
end
it { is_expected.to raise_error(Puppet::Error) }
end
end
16 changes: 14 additions & 2 deletions templates/prospector.yml.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
---
- type: <%= @input_type %>
<%- if @input_type != 'docker' -%>
paths:
<%- @paths.each do |log_path| -%>
- <%= log_path %>
<%- @paths.each do |log_path| -%>
- <%= log_path %>
<%- end -%>
<%- else -%>
containers:
ids:
<%- @containers_ids.each do |id| -%>
- <%= id %>
<%- end -%>
path: <%= @containers_path %>
stream: <%= @containers_stream %>
combine_partial: <%= @combine_partial %>
cri.parse_flags: <%= @cri_parse_flags %>
<%- end %>
<%- if @encoding -%>
encoding: <%= @encoding %>
<%- end -%>
Expand Down