Skip to content

Commit

Permalink
Merge pull request #116 from aquantumofdata/master
Browse files Browse the repository at this point in the history
Adds the ability to change the default category in the files added to the sumo sources folder.
  • Loading branch information
duchatran authored Feb 7, 2017
2 parents da1ed85 + f800bdc commit 22e7b7d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file is used to list changes made in each version of sumologic-collector.

## 1.2.18
* Adds the ability to define the source categories for the default files created in the json source
folder.

## 1.2.17
* Merged PR#85,86 : Add service retries attempts and delays, fixed online help doc link.

Expand Down
7 changes: 7 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@

# Collector Restart Command
default['sumologic']['collectorRestartCmd'] = "#{default['sumologic']['installDir']}/collector restart"

# Syslog source category
default['sumologic']['syslog_cat'] = 'OS/Linux/System'

# Security source category
default['sumologic']['security_cat'] = 'OS/Linux/Security'

when 'windows'
# Install Path
default['sumologic']['installDir'] = 'C:/sumo' # We'd like to set this to C:/Program Files/Sumo Logic Collector', but there are issues with the Program Files directory.
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
license 'Apache v2.0'
description 'Installs/Configures sumologic-collector'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '1.2.17'
version '1.2.18'
attribute 'sumologic/credentials/bag_name',
display_name: "Credentials bag name",
type: "string",
Expand Down
6 changes: 6 additions & 0 deletions recipes/sumojsondir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,17 @@
template "#{node['sumologic']['sumo_json_path']}/localfile-system.json" do
cookbook node['sumologic']['json_config_cookbook']
source "localfile-system-dir.json.erb"
variables({
:category => node['sumologic']['syslog_cat']
})
end

template "#{node['sumologic']['sumo_json_path']}/localfile-security.json" do
cookbook node['sumologic']['json_config_cookbook']
source "localfile-security-dir.json.erb"
variables({
:category => node['sumologic']['security_cat']
})
end

# This is an example of another local file source, note the use of variables in this template
Expand Down
2 changes: 1 addition & 1 deletion templates/default/localfile-security-dir.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"useAutolineMatching": true,
"forceTimeZone": false,
"timeZone": "UTC",
"category": "OS/Linux/Security",
"category": "<%= @category %>",
<% case node["platform_family"] -%>
<% when 'rhel' %>
"pathExpression":"/var/log/secure"
Expand Down
2 changes: 1 addition & 1 deletion templates/default/localfile-system-dir.json.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"useAutolineMatching": true,
"forceTimeZone": false,
"timeZone": "UTC",
"category": "OS/Linux/System",
"category": "<%= @category %>",
<% case node["platform_family"] -%>
<% when 'rhel' %>
"pathExpression":"/var/log/messages"
Expand Down

0 comments on commit 22e7b7d

Please sign in to comment.