add bundle:rsyslogd

This commit is contained in:
Franzi 2023-08-28 17:21:48 +02:00
parent 36dac3be7c
commit 39576fda38
Signed by: kunsi
GPG key ID: 12E3D2136B818350
6 changed files with 89 additions and 3 deletions

View file

@ -0,0 +1,10 @@
/var/log/rsyslog/*/*.log
{
rotate 4
daily
missingok
notifempty
compress
delaycompress
copytruncate
}

View file

@ -0,0 +1,18 @@
# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")
# provides TCP syslog reception
module(load="imtcp")
input(type="imtcp" port="514")
$FileOwner root
$FileGroup adm
$FileCreateMode 0640
$DirCreateMode 0755
$Umask 0022
$WorkDirectory /var/spool/rsyslog
$template remote-incoming-logs,"/var/log/rsyslog/%HOSTNAME%/%PROGRAMNAME%.log"
*.* ?remote-incoming-logs

18
bundles/rsyslogd/items.py Normal file
View file

@ -0,0 +1,18 @@
files['/etc/logrotate.d/rsyslog'] = {
'source': 'logrotate.conf',
}
files['/etc/rsyslog.conf'] = {
'triggers': {
'svc_systemd:rsyslog:restart',
},
}
svc_systemd['rsyslog'] = {
'needs': {
'pkg_apt:rsyslog',
},
'after': {
'file:/etc/rsyslog.conf',
},
}

View file

@ -0,0 +1,32 @@
from bundlewrap.metadata import atomic
defaults = {
'apt': {
'packages': {
'rsyslog': {},
},
},
'icinga2_api': {
'rsyslog': {
'services': {
'RSYSLOGD PROCESS': {
'command_on_monitored_host': '/usr/local/share/icinga/plugins/check_systemd_unit rsyslog',
},
},
},
},
}
@metadata_reactor.provides(
'firewall/port_rules',
)
def firewall(metadata):
return {
'firewall': {
'port_rules': {
'514': atomic(metadata.get('rsyslogd/restrict-to', set())),
'514/udp': atomic(metadata.get('rsyslogd/restrict-to', set())),
},
},
}

View file

@ -7,9 +7,6 @@ defaults = {
'ntp': { 'ntp': {
'installed': False, 'installed': False,
}, },
'rsyslog': {
'installed': False,
},
}, },
}, },
'icinga2_api': { 'icinga2_api': {
@ -26,6 +23,11 @@ defaults = {
}, },
} }
if not node.has_bundle('rsyslogd'):
defaults['apt']['packages']['rsyslog'] = {
'installed': False,
}
if node.has_bundle('apt') and node.os_version[0] > 10: if node.has_bundle('apt') and node.os_version[0] > 10:
defaults['apt']['packages']['systemd-timesyncd'] = { defaults['apt']['packages']['systemd-timesyncd'] = {
'after': { 'after': {

View file

@ -8,6 +8,7 @@ nodes['home.nas'] = {
'mixcloud-downloader', 'mixcloud-downloader',
'mosquitto', 'mosquitto',
'nfs-server', 'nfs-server',
'rsyslogd',
'scansnap', 'scansnap',
'smartd', 'smartd',
'vmhost', 'vmhost',
@ -133,6 +134,11 @@ nodes['home.nas'] = {
}, },
}, },
}, },
'rsyslogd': {
'restrict-to': {
'home',
},
},
'smartd': { 'smartd': {
'disks': { 'disks': {
'/dev/nvme0', '/dev/nvme0',