Added README.md and server.pp
This commit is contained in:
Родитель
85ba8c87b4
Коммит
58db7f00d8
|
@ -0,0 +1,23 @@
|
|||
# puppet-rsyslog
|
||||
puppet-rsyslog is a module for puppet to manage rsyslog client and server
|
||||
|
||||
## How to use
|
||||
```include rsyslog::client```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
$rsyslog_server_dir = "/path/to/target/directory/"
|
||||
include rsyslog::server
|
||||
```
|
||||
|
||||
Both can be installed at the same time.
|
||||
|
||||
Default server name is 'log'.
|
||||
$rsyslog_server_dir defaults to '/srv/log/'
|
||||
|
||||
### Setting a different server
|
||||
```
|
||||
$rsyslog_server = "another.server.domain.tld"
|
||||
include rsyslog::client
|
||||
```
|
|
@ -4,6 +4,11 @@ class rsyslog::params {
|
|||
default => $rsyslog_server,
|
||||
}
|
||||
|
||||
$server_dir = $rsyslog_server_dir ? {
|
||||
'' => '/srv/log/',
|
||||
default => $rsyslog_server_dir,
|
||||
}
|
||||
|
||||
case $operatingsystem {
|
||||
/(Ubuntu|Debian)/: {
|
||||
$rsyslog_package_name = 'rsyslog'
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class rsyslog::server inherits rsyslog {
|
||||
file { $rsyslog::params::server_conf:
|
||||
owner => root,
|
||||
group => root,
|
||||
ensure => file,
|
||||
content => template("${module_name}/server.conf.erb"),
|
||||
require => Class['rsyslog::install'],
|
||||
notify => Class['rsyslog::service'],
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
# File is managed by puppet
|
||||
|
||||
$ModLoad imudp
|
||||
$UDPServerRun 514
|
||||
|
||||
$ModLoad imtcp
|
||||
$TCPServerRun 514
|
||||
|
||||
$ModLoad imrelp
|
||||
$InputRELPServerRun 2514
|
||||
|
||||
$FileOwner root
|
||||
$FileGroup adm
|
||||
$FileCreateMode 0640
|
||||
$DirCreateMode 0750
|
||||
|
||||
# Templates
|
||||
$Template dynAuthLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/auth.log"
|
||||
$Template dynSyslog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/syslog"
|
||||
$Template dynCronLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/cron.log"
|
||||
$Template dynDaemonLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/daemon.log"
|
||||
$Template dynKernLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/kern.log"
|
||||
$Template dynUserLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/user.log"
|
||||
$Template dynMailLog,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/mail.log"
|
||||
$Template dynDebug,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/debug"
|
||||
$Template dynMessages,"<%= scope.lookupvar('rsyslog::params::server_dir') %>%source:R,ERE,1,DFLT:([A-Za-z-]*)--end%/messages"
|
||||
|
||||
# Rules
|
||||
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
|
Загрузка…
Ссылка в новой задаче