Skip to content

Sync with latest code #325

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

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
2db93f2
Add SSL support
Sep 10, 2013
e03b45b
Fix typo curly brace
Sep 10, 2013
eedbeba
Remove the *.* for sending to /var/log/syslog
Sep 12, 2013
87f87b8
Send local0 to drupal
Sep 20, 2013
4c8b5bf
Add drupal to server configuration
Sep 24, 2013
cb0b199
Prevent duplicate messages appearing
Sep 26, 2013
4edc98b
Try to return rsyslog logging to more normal places (syslog instead o…
Jan 24, 2014
3298534
Update client.conf.erb
Feb 7, 2014
32977bd
Update server-default.conf.erb
Feb 7, 2014
96e2146
Merge pull request #1 from puppetlabs-operations/new_syslog_rules
Feb 7, 2014
4e38e9c
Increase max TCP sessions
Mar 24, 2014
e3bd3d7
Remove cron messages from syslog
Apr 17, 2014
d81eeb3
Merge pull request #2 from puppetlabs-operations/remove_cron
Apr 17, 2014
5a78135
Remove logging to messages, log to syslog
Jul 1, 2014
14fe497
Merge pull request #3 from puppetlabs-operations/remove_messages
Ziaunys Jul 1, 2014
56f80f0
Update rsyslog::client to handle PE 3.7 null value
Dec 30, 2014
299eaee
Set gnutls install to same variable as other packages
Mar 3, 2015
5b56a09
Remove -c4 flag
Mar 3, 2015
8e7f6c5
Merge pull request #4 from puppetlabs-operations/latest_version
Ziaunys Mar 3, 2015
37da48b
Remove custom_config parameter
Sep 30, 2015
474ceed
Merge pull request #5 from puppetlabs-operations/remove_custom_config
Sep 30, 2015
a9fe0c1
(bug) Fix content snipper for rsyslog server
Nov 5, 2015
47a471c
Merge pull request #6 from puppetlabs-operations/fix_real_content
danieldreier Nov 5, 2015
359221f
Migrate default file to template.
ody Mar 2, 2016
4d64f04
Merge pull request #7 from puppetlabs-operations/erb
ody Mar 2, 2016
55e0975
(FORGE) Add capability to opt out of drupal.log inclusion
nkanderson Dec 3, 2020
c2ed97a
(MAINT) Add client params to docs in README
nkanderson Dec 4, 2020
8b4fdc3
Merge pull request #9 from nkanderson/pf_2269_condtional_drupal_log
mattkirby Dec 4, 2020
e0029f3
Adding protocol format field to rsyslog::client
mikkergimenez Nov 8, 2018
f0aeb6d
Merge pull request #10 from nkanderson/maint_merge_branch
mattkirby Dec 4, 2020
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ Manage rsyslog client and server via Puppet
custom_config => undef,
server => 'log',
port => '514',
ssl => false,
ssl_ca => undef,
include_drupal => true,
}
```

Expand Down Expand Up @@ -91,6 +94,9 @@ The following lists all the class parameters this module accepts.
log_auth_local true,false Just log auth facility locally. Defaults to false.
custom_config STRING Specify your own template to use for client config. Defaults to undef. Example usage: custom_config => 'rsyslog/my_config.erb
server STRING Rsyslog server to log to. Will be used in the client configuration file.
ssl true,false
ssl_ca STRING
include_drupal true,false Include a drupal.log file. Defaults to true for backwards compatibility reasons.

RSYSLOG::DATABASE CLASS PARAMETERS VALUES DESCRIPTION
-------------------------------------------------------------------
Expand Down
7 changes: 0 additions & 7 deletions files/rsyslog_default

This file was deleted.

35 changes: 22 additions & 13 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
# [*custom_params*]
# [*server*]
# [*port*]
# [*ssl*]
# [*ssl_ca*]
# [*include_drupal*]
#
# === Variables
#
Expand All @@ -22,25 +25,31 @@
# class { 'rsyslog::client': }
#
class rsyslog::client (
$log_remote = true,
$spool_size = '1g',
$remote_type = 'tcp',
$log_local = false,
$log_auth_local = false,
$custom_config = undef,
$custom_params = undef,
$server = 'log',
$port = '514'
$log_remote = true,
$spool_size = '1g',
$remote_type = 'tcp',
$log_local = false,
$log_auth_local = false,
$custom_config = undef,
$custom_params = undef,
$protocol_format = 'RSYSLOG_ForwardFormat',
$server = 'log',
$port = '514',
$ssl = false,
$ssl_ca = undef,
$include_drupal = true, # true for backwards compatibility reasons
) inherits rsyslog {

$content_real = $custom_config ? {
'' => template("${module_name}/client.conf.erb"),
default => template($custom_config),
if $custom_config {
$content_real = template($custom_config)
}
else {
$content_real = template("${module_name}/client.conf.erb")
}

rsyslog::snippet {'client':
ensure => present,
content => $content_real,
}
}

}
2 changes: 1 addition & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ensure => file,
owner => 'root',
group => $rsyslog::run_group,
source => 'puppet:///modules/rsyslog/rsyslog_default',
content => template("${module_name}/rsyslog_default.erb"),
require => Class['rsyslog::install'],
notify => Class['rsyslog::service'],
}
Expand Down
6 changes: 6 additions & 0 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@
}
}

if $rsyslog::ssl != false {
package { 'rsyslog-gnutls':
ensure => $rsyslog::package_status
}
}

}
6 changes: 3 additions & 3 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
$log_style = 'debian'
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/rsyslog/'
$spool_dir = '/var/spool/rsyslog'
$service_name = 'rsyslog'
$client_conf = "${rsyslog_d}client.conf"
$server_conf = "${rsyslog_d}server.conf"
Expand All @@ -51,7 +51,7 @@
$log_style = 'redhat'
$perm_file = '0600'
$perm_dir = '0750'
$spool_dir = '/var/lib/rsyslog/'
$spool_dir = '/var/lib/rsyslog'
$service_name = 'rsyslog'
$client_conf = "${rsyslog_d}client.conf"
$server_conf = "${rsyslog_d}server.conf"
Expand All @@ -72,7 +72,7 @@
$log_style = 'debian'
$perm_file = '0640'
$perm_dir = '0755'
$spool_dir = '/var/spool/syslog/'
$spool_dir = '/var/spool/syslog'
$service_name = 'syslogd'
$client_conf = "${rsyslog_d}client.conf"
$server_conf = "${rsyslog_d}server.conf"
Expand Down
23 changes: 10 additions & 13 deletions manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@
# [*enable_udp*]
# [*enable_onefile*]
# [*server_dir*]
# [*custom_config*]
# [*high_precision_timestamps*]
# [*ssl*]
# [*ssl_ca*]
# [*ssl_cert*]
# [*ssl_key*]
#
# === Variables
#
Expand All @@ -21,26 +24,20 @@
#
# Create seperate directory per host
#
# class { 'rsyslog::server':
# custom_config => 'rsyslog/server-hostname.conf.erb'
# }
#
class rsyslog::server (
$enable_tcp = true,
$enable_udp = true,
$enable_onefile = false,
$server_dir = '/srv/log',
$custom_config = undef,
$high_precision_timestamps = false
$high_precision_timestamps = false,
$ssl = false,
$ssl_ca = undef,
$ssl_cert = undef,
$ssl_key = undef
) inherits rsyslog {

$real_content = $custom_config ? {
'' => template("${module_name}/server-default.conf.erb"),
default => template($custom_config),
}

rsyslog::snippet {'server':
ensure => present,
content => $real_content,
content => template("${module_name}/server-default.conf.erb"),
}
}
36 changes: 26 additions & 10 deletions templates/client.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,35 @@ $ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList # run asynchronously
$ActionResumeRetryCount -1 # infinety retries if host is down

<% if scope.lookupvar('rsyslog::client::ssl') -%>
# Setup SSL connection.
# CA/Cert
$DefaultNetStreamDriverCAFile <%= scope.lookupvar('rsyslog::client::ssl_ca') %>

# Connection settings.
$DefaultNetstreamDriver gtls
$ActionSendStreamDriverMode 1
$ActionSendStreamDriverAuthMode anon
<% end -%>

<% if scope.lookupvar('rsyslog::client::log_remote') -%>
# Log to remote syslog server using <%= scope.lookupvar('rsyslog::client::remote_type') %>
<% if scope.lookupvar('rsyslog::client::remote_type') == 'tcp' -%>
*.* @@<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;RSYSLOG_ForwardFormat
*.* @@<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;<%= scope.lookupvar('rsyslog::client::protocol_format') -%>
<% else -%>
*.* @<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;RSYSLOG_ForwardFormat
*.* @<%= scope.lookupvar('rsyslog::client::server') -%>:<%= scope.lookupvar('rsyslog::client::port') -%>;<%= scope.lookupvar('rsyslog::client::protocol_format') -%>
<% end -%>
<% end -%>

<% if scope.lookupvar('rsyslog::client::log_auth_local') or scope.lookupvar('rsyslog::client::log_local') -%>
# We log locally, restore to default format
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat

<% if scope.lookupvar('rsyslog::client::include_drupal') -%>
# Drupal stuff
if $syslogfacility-text == 'local0' then /var/log/drupal.log
&~
<% end -%>
<% if scope.lookupvar('rsyslog::log_style') == 'debian' -%>
# Log auth messages locally
auth,authpriv.* /var/log/auth.log
Expand All @@ -34,13 +50,13 @@ auth,authpriv.* /var/log/secure
<% if scope.lookupvar('rsyslog::log_style') == 'debian' -%>
# First some standard log files. Log by facility.
#
*.*;auth,authpriv.none -/var/log/syslog
cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
*.*;auth,authpriv.none,cron.none -/var/log/syslog
cron.* /var/log/cron.log
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
#lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log

#
# Logging for the mail system. Split it up so that
Expand Down Expand Up @@ -79,7 +95,7 @@ news.notice -/var/log/news/news.notice

# The named pipe /dev/xconsole is for the `xconsole' utility. To use it,
# you must invoke `xconsole' with the `-file' option:
#
#
# $ xconsole -file /dev/xconsole [...]
#
# NOTE: adjust the list below, or you'll go crazy if you have a reasonably
Expand Down
10 changes: 10 additions & 0 deletions templates/rsyslog_default.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# File is managed by puppet

<% case @osfamily -%>
<% when 'Debian' -%>
# Debian, Ubuntu
RSYSLOGD_OPTIONS=""
<% when 'RedHat' -%>
# CentOS, RedHat, Fedora
SYSLOGD_OPTIONS=""
<% end -%>
7 changes: 3 additions & 4 deletions templates/server-default.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,18 @@ $Template dynUserLog,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%sou
$Template dynMailLog,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/mail.log"
$Template dynDebug,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/debug"
$Template dynMessages,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/messages"
$Template dynDrupal,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/drupal.log"

# Rules
if $syslogfacility-text == 'local0' then ?dynDrupal
&~
auth,authpriv.* ?dynAuthLog
*.*;auth,authpriv.none,mail.none,cron.none -?dynSyslog
cron.* ?dynCronLog
daemon.* -?dynDaemonLog
kern.* -?dynKernLog
mail.* -?dynMailLog
user.* -?dynUserLog
*.=info;*.=notice;*.=warn;\
auth.none,authpriv.none;\
cron.none,daemon.none;\
mail.none,news.none -?dynMessages
<% else -%>
# Template
$Template dynAllMessages,"<%= scope.lookupvar('rsyslog::server::server_dir') -%>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/messages"
Expand Down
14 changes: 14 additions & 0 deletions templates/server/_default-header.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ $ModLoad imudp
<% if scope.lookupvar('rsyslog::server::enable_tcp') -%>
# Load TCP module
$ModLoad imtcp
$InputTCPMaxSessions 1000 # Maximum TCP sessions (default 200)
<% end -%>

<% if scope.lookupvar('rsyslog::server::high_precision_timestamps') == false -%>
Expand All @@ -16,5 +17,18 @@ $ModLoad imtcp
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
<% end -%>

<% if scope.lookupvar('rsyslog::server::ssl') -%>
# Server side SSL.
$DefaultNetstreamDriver gtls

# Cert files.
$DefaultNetstreamDriverCAFile <%= scope.lookupvar('rsyslog::server::ssl_ca') %>
$DefaultNetstreamDriverCertFile <%= scope.lookupvar('rsyslog::server::ssl_cert') %>
$DefaultNetstreamDriverKeyFile <%= scope.lookupvar('rsyslog::server::ssl_key') %>

$InputTCPServerStreamDriverMode 1
$InputTCPServerStreamDriverAuthMode anon
<% end -%>

# Switch to remote ruleset
$RuleSet remote