Syslog-ng LXC

Da EigenWiki.
Vai alla navigazione Vai alla ricerca

Setup syslog-ng on gentoo LXC container

Install syslog-ng and logrotate

emerge -avq app-admin/syslog-ng app-admin/logrotate

Configure syslog-ng for LXC container

Usually kernel messages and other kernel stuff are not accessible for security from the LXC container so syslog-ng cannot start with default gentoo configuration, moreover message sended to /dev/tty12 will loop causing a lor of undesidered log messages to avoid those issue we have to edit /etc/syslog-ng/syslog-ng.conf

Comment every kernel specific lines

#Manually edited
#destination kern { file("/var/log/kern.log"); file("/dev/tty12"); };
#Manually edited
#filter f_kern { facility(kern); };
#Manually edited
#log { source(kernsrc); filter(f_kern); destination(kern); };
#Manually edited
#log { source(kernsrc); filter(f_pax); destination(pax); };
#log { source(kernsrc); filter(f_grsec); destination(grsec); };
#log { source(kernsrc); filter(f_audit); destination(audit); };
#log { source(kernsrc); filter(f_avc); destination(avc); };

Change every /dev/tty12 apparence with /var/log/messages

#Manually edited
##destination kern { file("/var/log/kern.log"); file("/dev/tty12"); };
#destination kern { file("/var/log/kern.log"); file("/var/log/messages"); };
#Manually edited
#destination console_all { file("/dev/tty12"); };
destination console_all { file("/var/log/messages"); };


Make syslog-ng start automagically at boot

Add syslog-nd to default runlevel

rc-update add syslog-ng default