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

Allow removal of cron log file and added configurable action fields #271

Open
wants to merge 6 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
61 changes: 33 additions & 28 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,34 +39,39 @@
# class { 'rsyslog::client': }
#
class rsyslog::client (
$log_remote = true,
$spool_size = '1g',
$spool_timeoutenqueue = false,
$remote_type = 'tcp',
$remote_forward_format = 'RSYSLOG_ForwardFormat',
$log_local = false,
$disable_xconsole = false,
$log_local_custom = undef,
$log_auth_local = false,
$listen_localhost = false,
$split_config = false,
$custom_config = undef,
$custom_params = undef,
$server = 'log',
$port = '514',
$remote_servers = false,
$ssl = false,
$ssl_ca = undef,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_permitted_peer = undef,
$ssl_auth_mode = 'anon',
$log_templates = false,
$log_filters = false,
$actionfiletemplate_cust = false,
$actionfiletemplate = false,
$high_precision_timestamps = false,
$imfiles = undef
$log_remote = true,
$spool_size = '1g',
$spool_timeoutenqueue = false,
$remote_type = 'tcp',
$remote_forward_format = 'RSYSLOG_ForwardFormat',
$log_local = false,
$disable_xconsole = false,
$log_local_custom = undef,
$log_auth_local = false,
$listen_localhost = false,
$split_config = false,
$custom_config = undef,
$custom_params = undef,
$server = 'log',
$port = '514',
$remote_servers = false,
$ssl = false,
$ssl_ca = undef,
$ssl_cert = undef,
$ssl_key = undef,
$ssl_permitted_peer = undef,
$ssl_auth_mode = 'anon',
$log_templates = false,
$log_filters = false,
$actionfiletemplate_cust = false,
$actionfiletemplate = false,
$high_precision_timestamps = false,
$imfiles = undef,
$use_cron = true,
$action_queue_filename = 'queue',
$action_queue_save_on_shutdown = 'no',
$action_queue_type = 'LinkedList',
$action_resume_retry_count = '-1',
) inherits rsyslog::params {
include ::rsyslog

Expand Down
18 changes: 14 additions & 4 deletions templates/client/config.conf.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
# An "In-Memory Queue" is created for remote logging.
$WorkDirectory <%= scope.lookupvar('rsyslog::spool_dir') -%> # where to place spool files
$ActionQueueFileName queue # unique name prefix for spool files
<% if scope.lookupvar('rsyslog::client::action_queue_filename') and scope.lookupvar('rsyslog::client::action_queue_filename') != :undef -%>
$ActionQueueFileName <%= scope.lookupvar('rsyslog::client::action_queue_filename') -%> # unique name prefix for spool files
<% end -%>
<% if scope.lookupvar('rsyslog::client::spool_size') and scope.lookupvar('rsyslog::client::spool_size') != :undef -%>
$ActionQueueMaxDiskSpace <%= scope.lookupvar('rsyslog::client::spool_size') -%> # spool space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
<% end -%>
<% if scope.lookupvar('rsyslog::client::action_queue_save_on_shutdown') and scope.lookupvar('rsyslog::client::action_queue_save_on_shutdown') != :undef -%>
$ActionQueueSaveOnShutdown <%= scope.lookupvar('rsyslog::client::action_queue_save_on_shutdown') -%> # whether to save messages to disk on shutdown
<% end -%>
<% if scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%>
$ActionQueueTimeoutEnqueue <%= scope.lookupvar('rsyslog::client::spool_timeoutenqueue') -%> # time to wait before discarding on full spool
<% end -%>
$ActionQueueType LinkedList # run asynchronously
$ActionResumeRetryCount -1 # infinety retries if host is down
<% if scope.lookupvar('rsyslog::client::action_queue_type') and scope.lookupvar('rsyslog::client::action_queue_type') != :undef -%>
$ActionQueueType <%= scope.lookupvar('rsyslog::client::action_queue_type') -%> # processing type
<% end -%>
<% if scope.lookupvar('rsyslog::client::action_resume_retry_count') and scope.lookupvar('rsyslog::client::action_resume_retry_count') != :undef -%>
$ActionResumeRetryCount <%= scope.lookupvar('rsyslog::client::action_resume_retry_count') -%> # retries if host is down
<% end -%>
<% if scope.lookupvar('rsyslog::client::log_templates') and ! scope.lookupvar('rsyslog::client::log_templates').empty?-%>

# Define custom logging templates
Expand Down
2 changes: 2 additions & 0 deletions templates/client/local.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ auth.info;authpriv.info /var/log/auth.log
# First some standard log files. Log by facility.
#
*.*;auth,authpriv.none -/var/log/syslog
<% if scope.lookupvar('rsyslog::client::use_cron') -%>
cron.* /var/log/cron.log
<% end -%>
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
Expand Down
12 changes: 11 additions & 1 deletion templates/rsyslog.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ $KLogPermitNonKernelFacility on
#
# Set max message size for sending and receiving
#
<% if scope.lookupvar('rsyslog::max_message_size') -%>
$MaxMessageSize <%= scope.lookupvar('rsyslog::max_message_size') %>
<% end -%>

#
# Set rate limit for messages received.
Expand Down Expand Up @@ -61,13 +63,21 @@ $RepeatedMsgReduction on
$FileOwner <%= scope.lookupvar('rsyslog::log_user') %>
$FileGroup <%= scope.lookupvar('rsyslog::log_group') %>
$FileCreateMode <%= scope.lookupvar('rsyslog::perm_file') %>
<% if scope.lookupvar('rsyslog::log_user') and scope.lookupvar('rsyslog::log_user') != :undef -%>
$DirOwner <%= scope.lookupvar('rsyslog::log_user') %>
<% end -%>
<% if scope.lookupvar('rsyslog::log_group') and scope.lookupvar('rsyslog::log_group') != :undef -%>
$DirGroup <%= scope.lookupvar('rsyslog::log_group') %>
<% end -%>
$DirCreateMode <%= scope.lookupvar('rsyslog::perm_dir') %>
<% if scope.lookupvar('rsyslog::priv_drop_user') and scope.lookupvar('rsyslog::priv_drop_user') != :undef -%>
$PrivDropToUser <%= scope.lookupvar('rsyslog::run_user') %>
<% end -%>
<% if scope.lookupvar('rsyslog::priv_drop_group') and scope.lookupvar('rsyslog::priv_drop_group') != :undef -%>
$PrivDropToGroup <%= scope.lookupvar('rsyslog::run_group') %>
<% end -%>
$WorkDirectory <%= scope.lookupvar('rsyslog::spool_dir') %>
<% if scope.lookupvar('rsyslog::umask') -%>
<% if scope.lookupvar('rsyslog::umask') and scope.lookupvar('rsyslog::umask') != :undef -%>
$Umask <%= scope.lookupvar('rsyslog::umask') %>
<% end -%>

Expand Down