Skip to content

Commit

Permalink
Merge pull request #124 from rmcleod8/directive_tweaks
Browse files Browse the repository at this point in the history
CH-#123 - RSYSLOG COOKBOOK :: Extending Attributes in lieu of hardcoded values
  • Loading branch information
tas50 committed Dec 30, 2016
2 parents 1f82680 + b07898e commit 5f7dc22
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 5 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ See `attributes/default.rb` for default values.
- `node['rsyslog']['max_message_size']` - Specify the maximum allowed message size. Default is 2k.
- `node['rsyslog']['user']` - Who should own the configuration files and directories
- `node['rsyslog']['group']` - Who should group-own the configuration files and directories
- `node['rsyslog']['dir_owner']` - Who should own the log directories
- `node['rsyslog']['dir_group']` - Who should group-own the log directories
- `node['rsyslog']['file_create_mode']` - Mode that should be set when creating log files
- `node['rsyslog']['dir_create_mode']` - Mode that should be set when creating log directories
- `node['rsyslog']['umask']` - Specify the processes umask
- `node['rsyslog']['defaults_file']` - The full path to the defaults/sysconfig file for the service.
- `node['rsyslog']['service_name']` - The platform-specific name of the service
- `node['rsyslog']['preserve_fqdn']` - Value of the `$PreserveFQDN` configuration directive in `/etc/rsyslog.conf`. Default is 'off' for compatibility purposes.
Expand All @@ -48,6 +53,7 @@ See `attributes/default.rb` for default values.
- `node['rsyslog']['default_facility_logs']` - Hash containing log facilities and destinations used in `50-default.conf` template.
- `node['rsyslog']['default_file_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for local log files.
- `node['rsyslog']['default_remote_template']` - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for sending to remote servers.
- `node['rsyslog']['templates']` - Allows a user to specify a dynamic filename and the format of the logs
- `node['rsyslog']['rate_limit_interval']` - Value of the $SystemLogRateLimitInterval configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.
- `node['rsyslog']['rate_limit_burst']` - Value of the $SystemLogRateLimitBurst configuration directive in `/etc/rsyslog.conf`. Default is nil, leaving it to the platform default.
- `node['rsyslog']['action_queue_max_disk_space']` - Max amount of disk space the disk-assisted queue is allowed to use ([more info](http://www.rsyslog.com/doc/queues.html)).
Expand Down
8 changes: 7 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
default['rsyslog']['use_local_ipv4'] = false
default['rsyslog']['allow_non_local'] = false
default['rsyslog']['custom_remote'] = []
default['rsyslog']['additional_directives'] = {}
default['rsyslog']['additional_directives'] = {}
default['rsyslog']['templates'] = %w()

# The most likely platform-specific attributes
default['rsyslog']['service_name'] = 'rsyslog'
Expand All @@ -62,6 +63,11 @@
default['rsyslog']['priv_user'] = nil
default['rsyslog']['priv_group'] = nil
default['rsyslog']['modules'] = %w(imuxsock imklog)
default['rsyslog']['file_create_mode'] = '0640'
default['rsyslog']['dir_create_mode'] = '0755'
default['rsyslog']['umask'] = '0022'
default['rsyslog']['dir_owner'] = 'root'
default['rsyslog']['dir_group'] = 'adm'

# platform specific attributes
case node['platform']
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license 'Apache 2.0'
description 'Installs and configures rsyslog'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '5.0.1'
version '5.0.2'

recipe 'rsyslog', 'Sets up rsyslog for local logging'
recipe 'rsyslog::client', 'Sets up a client to log to a remote rsyslog server'
Expand Down
17 changes: 14 additions & 3 deletions templates/default/rsyslog.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ $ActionFileDefaultTemplate <%= node["rsyslog"]["default_file_template"] %>
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
<% end -%>
<% if node['rsyslog']['templates'] && !node['rsyslog']['templates'].empty? -%>
<% [*node['rsyslog']['templates']].each do |template| %>
#
# Additional Log templates
#
$Template <%= template %>
<% end %>
<% end %>
# Filter duplicated messages
$RepeatedMsgReduction <%= node['rsyslog']['repeated_msg_reduction'] %>

Expand All @@ -87,11 +95,14 @@ $WorkDirectory <%= node['rsyslog']['working_dir'] %>
#
# Set the default permissions for all log files.
#
$Umask <%= node['rsyslog']['umask'] %>
$FileOwner <%= node['rsyslog']['user'] %>
$FileGroup <%= node['rsyslog']['group'] %>
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$FileCreateMode <%= node['rsyslog']['file_create_mode'] %>
$DirOwner <%= node['rsyslog']['dir_owner'] %>
$DirGroup <%= node['rsyslog']['dir_group'] %>
$DirCreateMode <%= node['rsyslog']['dir_create_mode'] %>
<% if node['rsyslog']['priv_seperation'] %>
$PrivDropToUser <%= node['rsyslog']['priv_user'] || node['rsyslog']['user'] %>
$PrivDropToGroup <%= node['rsyslog']['priv_group'] || node['rsyslog']['group'] %>
Expand Down

0 comments on commit 5f7dc22

Please sign in to comment.