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

Adding support for CentOS/Redhat #10

Open
wants to merge 17 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
8 changes: 8 additions & 0 deletions files/elastic.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[elastic-5.x]
name=Elastic repository for 5.x packages
baseurl=https://artifacts.elastic.co/packages/5.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
6 changes: 6 additions & 0 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
}
Class['apt::update'] -> Package['filebeat']
}
'RedHat': {
package {'filebeat':
ensure => present,
require => Class['::elastic_stack::repo']
}
}
default: {
fail('Could not configure apt resource for elasticsearch filebeats')
}
Expand Down
4 changes: 4 additions & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
$export_log_paths = ['/var/log/*.log']
$config_path = '/etc/filebeat'
}
'RedHat': {
$export_log_paths = ['/var/log/*.log']
$config_path = '/etc/filebeat'
}
default: {
fail('Could not determine default params for your Operating System')
}
Expand Down
21 changes: 11 additions & 10 deletions templates/filebeat.yml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,24 +22,25 @@ filebeat:
<% end -%>
<% if prospector['fields'] -%>
fields:
<% prospector['fields'].each do |k,v| -%>
<%- prospector['fields'].each do |k,v| -%>
<%= k %>: '<%= v %>'
<% end -%>
<%- end -%>
<% end -%>
<% if prospector['json_keys_under_root'] -%>
<%# if @json_message_key != '' %>
<% if prospector['doc_type'] == 'json' -%>
# Parse each line as JSON
json.message_key: <%= prospector['json_message_key'] %>
<% end -%>
<%# if @json_keys_under_root != '' %>
<% if prospector['doc_type'] == 'json' -%>
json.keys_under_root: <%= prospector['json_keys_under_root'] %>
<% end -%>
<% if prospector['json_add_error_key'] -%>
json.add_error_key: <%= prospector['json_add_error_key'] %>
<% end -%>
<% if prospector['json_add_error_key'] -%>
json.add_error_key: <%= prospector['add_error_key'] %>
<% end -%>
<% if prospector['json_message_key'] -%>
json.message_key: <%= prospector['json_message_key'] %>
<% end -%>
<% end -%>
registry_file: /var/lib/filebeat/registry
registry_file: /var/lib/filebeat/registry
output:
<% if @logstash_hosts != [] -%>

output.logstash:
Expand Down