Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for exclude_lines in prospectors. Review newlines in prospectors template #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions manifests/common/headers.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@
$logging = hiera('beats::logging', undef),
) {
concat { "/etc/${title}/${title}.yml":
group => 'root',
mode => '0755',
owner => 'root',
order => 'numeric',
require => Package[$title],
group => 'root',
mode => '0755',
owner => 'root',
order => 'numeric',
require => Package[$title],
show_diff => false,
}
concat::fragment {"${title}-common-shipper-config":
target => "/etc/${title}/${title}.yml",
content => template('beats/shipper.erb'),
order => 01,
order => '01',
}
if $uid and $gid {
concat::fragment {"${title}-common-runopts":
target => "/etc/${title}/${title}.yml",
content => template('beats/runopts.erb'),
order => 02,
order => '02',
}
}
concat::fragment {"${title}-common-output-header":
target => "/etc/${title}/${title}.yml",
content => template('beats/outputs/output.header.erb'),
order => 20
order => '20',
}
concat::fragment {"${title}-common-logging":
target => "/etc/${title}/${title}.yml",
content => template('beats/logging.erb'),
order => 100
order => '100',
}
}
4 changes: 2 additions & 2 deletions manifests/filebeat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
$registry_file = '/var/lib/filebeat/registry',
$spool_size = 1024,
){
include beats::filebeat::config
include ::beats::filebeat::config
case $::osfamily {
'Debian': {
include ::apt::update

package {'filebeat':
ensure => $ensure,
require => Class['apt::update']
require => Class['apt::update'],
}
}
'RedHat': {
Expand Down
2 changes: 1 addition & 1 deletion manifests/filebeat/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
concat::fragment {'filebeat.header':
target => '/etc/filebeat/filebeat.yml',
content => template('beats/filebeat/filebeat.yml.erb'),
order => 05,
order => '05',
}
# We read them again to combine the variables defined at different levels
$p2 = hiera_hash('beats::filebeat::prospectors', {})
Expand Down
1 change: 1 addition & 0 deletions manifests/filebeat/prospector.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
$doc_type = undef,
$max_bytes = undef,
$multiline = undef,
$exclude_lines = undef,
)
{
concat::fragment {"prospector-${title}":
Expand Down
8 changes: 4 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@
if ($manage_repo == true) {
case $::osfamily {
'RedHat': {
include beats::repo::yum, beats::package, beats::config
include ::beats::repo::yum, ::beats::package, ::beats::config
Class['beats::repo::yum'] -> Class['beats::package'] -> Class['beats::config']
}
'Debian': {
include beats::repo::apt, beats::package, beats::config
include ::beats::repo::apt, ::beats::package, ::beats::config
Class['beats::repo::apt'] -> Class['beats::package'] -> Class['beats::config']
}
default: { fail("${::osfamily} not supported yet") }
Expand All @@ -70,11 +70,11 @@
else {
case $::osfamily {
'RedHat': {
include beats::package, beats::config
include ::beats::package, ::beats::config
Class['beats::package'] -> Class['beats::config']
}
'Debian': {
include beats::package, beats::config
include ::beats::package, ::beats::config
Class['beats::package'] -> Class['beats::config']
}
default: { fail("${::osfamily} not supported yet") }
Expand Down
4 changes: 2 additions & 2 deletions manifests/metricbeat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
include ::apt::update
package {'metricbeat':
ensure => $ensure,
require => Class['apt::update']
require => Class['apt::update'],
}
}
'RedHat': {
Expand All @@ -24,7 +24,7 @@
default: { fail("${::osfamily} not supported yet") }
}

include beats::metricbeat::config
include ::beats::metricbeat::config

service { 'metricbeat':
ensure => running,
Expand Down
2 changes: 1 addition & 1 deletion manifests/metricbeat/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
concat::fragment {'metricbeat.header':
target => '/etc/metricbeat/metricbeat.yml',
content => template('beats/metricbeat/metricbeat.yml.erb'),
order => 06,
order => '06',
}
}
2 changes: 1 addition & 1 deletion manifests/outputs/elasticsearch.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
concat::fragment {"${title}-output-elasticsearch":
target => "/etc/${title}/${title}.yml",
content => template('beats/outputs/elasticsearch.erb'),
order => 21
order => 21,
}
}
2 changes: 1 addition & 1 deletion manifests/outputs/logstash.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
concat::fragment {"${title}-output-logstash":
target => "/etc/${title}/${title}.yml",
content => template('beats/outputs/logstash.erb'),
order => 22
order => 22,
}
}
8 changes: 4 additions & 4 deletions manifests/packetbeat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
$pgsql_max_rows = undef,
$pgsql_max_row_length = undef,
){
include beats::packetbeat::config
include ::beats::packetbeat::config

case $::osfamily {
'Debian': {
include ::apt::update
package {'packetbeat':
ensure => $beats::packetbeat::ensure,
require => Class['apt::update']
require => Class['apt::update'],
}
}
'RedHat': {
Expand All @@ -46,9 +46,9 @@
service { 'packetbeat':
ensure => 'stopped',
enable => false,
}
}
}
default: {
default: {
service { 'packetbeat':
ensure => running,
enable => true,
Expand Down
16 changes: 8 additions & 8 deletions manifests/packetbeat/config.pp
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
# Packetbeat config
class beats::packetbeat::config inherits beats::packetbeat {
class beats::packetbeat::config inherits ::beats::packetbeat {
beats::common::headers {'packetbeat':}
concat::fragment {'packetbeat.header':
target => '/etc/packetbeat/packetbeat.yml',
content => template('beats/packetbeat/packetbeat.yml.erb'),
order => 05,
order => '05',
}
concat::fragment {'protocols.header':
target => '/etc/packetbeat/packetbeat.yml',
content => template('beats/protocols.header.erb'),
order => 10,
order => '10',
}
if $http_enabled { include beats::protocols::http }
if $mysql_enabled { include beats::protocols::mysql }
if $pgsql_enabled { include beats::protocols::pgsql }
if $redis_enabled { include beats::protocols::redis }
}
if $::beats::packetbeat::http_enabled { include ::beats::protocols::http }
if $::beats::packetbeat::mysql_enabled { include ::beats::protocols::mysql }
if $::beats::packetbeat::pgsql_enabled { include ::beats::protocols::pgsql }
if $::beats::packetbeat::redis_enabled { include ::beats::protocols::redis }
}
4 changes: 2 additions & 2 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
case $::osfamily {

'Debian': {
class { 'beats::repo::apt': }
class { '::beats::repo::apt': }
}

'RedHat': {
class { 'beats::repo::yum': }
class { '::beats::repo::yum': }
}

default: { fail("${::osfamily} not supported yet") }
Expand Down
14 changes: 7 additions & 7 deletions manifests/repo/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
repos => 'main',
key => {
id => '46095ACC8548582C1A2699A9D27D666CD88E42B4',
server => 'pgp.mit.edu'
server => 'pgp.mit.edu',
},
include => {
'deb' => true
}
'deb' => true,
},
}
exec {'apt-get update':
command => 'apt-get -qq update',
path => '/usr/bin',
unless => ['/usr/bin/dpkg -l | /bin/grep apt-transport-https']
path => '/usr/bin',
unless => ['/usr/bin/dpkg -l | /bin/grep apt-transport-https'],
}
package {'apt-transport-https':
ensure => latest,
before => Apt::Source['elastic-beats'],
require => Exec['apt-get update']
require => Exec['apt-get update'],
}
}
}
2 changes: 1 addition & 1 deletion manifests/repo/yum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
descr => 'ES beats repository',
enabled => '1',
gpgcheck => '1',
gpgkey => 'http://packages.elastic.co/GPG-KEY-elasticsearch'
gpgkey => 'http://packages.elastic.co/GPG-KEY-elasticsearch',
}

}
Expand Down
6 changes: 3 additions & 3 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Beats service class
class beats::service() {
if $beats::packetbeat { include beats::packetbeat::service }
if $beats::filebeat { include beats::filebeat::service }
if $beats::topbeat { include beats::topbeat::service }
if $beats::packetbeat { include ::beats::packetbeat::service }
if $beats::filebeat { include ::beats::filebeat::service }
if $beats::topbeat { include ::beats::topbeat::service }
}
8 changes: 4 additions & 4 deletions manifests/topbeat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
$stats_proc = true,
$stats_filesystem = true,
){

case $::osfamily {
'Debian': {
include ::apt::update
package {'topbeat':
ensure => $ensure,
require => Class['apt::update']
require => Class['apt::update'],
}
}
'RedHat': {
Expand All @@ -24,8 +24,8 @@
default: { fail("${::osfamily} not supported yet") }
}

include beats::topbeat::config
include ::beats::topbeat::config

service { 'topbeat':
ensure => running,
enable => true,
Expand Down
4 changes: 2 additions & 2 deletions manifests/topbeat/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
concat::fragment {'topbeat.header':
target => '/etc/topbeat/topbeat.yml',
content => template('beats/topbeat/topbeat.yml.erb'),
order => 06,
order => '06',
}
}
}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"issues_url": "https://github.com/poolski/puppet-beats/issues",
"license": "GPL v2",
"license": "GPL-2.0",
"name": "poolski-beats",
"operatingsystem_support": [
{
Expand Down
29 changes: 15 additions & 14 deletions templates/filebeat/prospector.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@
fields:<% @fields.each do |key, value| %>
<%= key -%>: <%= value %>
<%- end -%>
<%- if @encoding -%> encoding: <%= @encoding %><% end -%>
<%- if @ignore_older -%> ignore_older: <%= @ignore_older %><% end -%>
<%- if @scan_frequency -%> scan_frequency: <%= @scan_frequency %><% end -%>
<%- if @harvester_buffer_size -%> harvester_buffer_size: <%= @harvester_buffer_size %><% end -%>
<%- if @tail_files -%> tail_files: <%= @tail_files %><% end -%>
<%- if @backoff -%> backoff: <%= @backoff %><% end -%>
<%- if @max_backoff -%> max_backoff: <%= @max_backoff %><% end -%>
<%- if @backoff_factor -%> backoff_factor: <%= @backoff_factor %><% end -%>
<%- if @partial_line_waiting -%> partial_line_waiting: <%= @partial_line_waiting %><% end -%>
<%- if @force_close_files -%> force_close_files: <%= @force_close_files %><% end -%>
<%- if @fields_under_root -%> fields_under_root: <%= @fields_under_root %><% end -%>
<%- if @doc_type -%> document_type: <%= @doc_type %><% end -%>
<%- if @input_type -%> input_type: <%= @input_type %><% end -%>
<%- if @max_bytes -%> max_bytes: <%= @max_bytes %><% end -%>
<%- if @encoding -%> encoding: <%= @encoding %><% end %>
<%- if @ignore_older -%> ignore_older: <%= @ignore_older %><% end %>
<%- if @scan_frequency -%> scan_frequency: <%= @scan_frequency %><% end %>
<%- if @harvester_buffer_size -%> harvester_buffer_size: <%= @harvester_buffer_size %><% end %>
<%- if @tail_files -%> tail_files: <%= @tail_files %><% end %>
<%- if @backoff -%> backoff: <%= @backoff %><% end %>
<%- if @max_backoff -%> max_backoff: <%= @max_backoff %><% end %>
<%- if @backoff_factor -%> backoff_factor: <%= @backoff_factor %><% end %>
<%- if @partial_line_waiting -%> partial_line_waiting: <%= @partial_line_waiting %><% end %>
<%- if @force_close_files -%> force_close_files: <%= @force_close_files %><% end %>
<%- if @fields_under_root -%> fields_under_root: <%= @fields_under_root %><% end %>
<%- if @doc_type -%> document_type: <%= @doc_type %><% end %>
<%- if @input_type -%> input_type: <%= @input_type %><% end %>
<%- if @max_bytes -%> max_bytes: <%= @max_bytes %><% end %>
<%- if @exclude_lines -%> exclude_lines: <%= @exclude_lines %><% end %>
<%- if @multiline -%> multiline:<% @multiline.each do |key, value| %>
<%= key -%>: <%= value -%><%- end -%>
<% end -%>
Expand Down
2 changes: 1 addition & 1 deletion tests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include packetbeat
include ::packetbeat