From 7ee97cb377187ff8cd4ade9d32b5de6af983e973 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 31 Mar 2009 20:45:09 -0400 Subject: * Make it easier to switch back and forth between logging providers (clog, fifo) * Add a $config['system']['usefifolog'] switch * Switch back to defaulting to clog --- etc/inc/system.inc | 47 +++++++++++++++++++++++++++++++---------------- 1 file changed, 31 insertions(+), 16 deletions(-) (limited to 'etc') diff --git a/etc/inc/system.inc b/etc/inc/system.inc index f714fe1..7815830 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -351,7 +351,22 @@ function system_syslogd_start() { mwexec("/usr/bin/killall -9 syslogd"); mwexec("/usr/bin/killall -9 fifolog_writer"); - + + // Define carious commands for logging + $fifolog_create = "/usr/sbin/fifolog_create -s "; + $fifolog_log = "|/usr/sbin/fifolog_writer "; + $clog_create = "/usr/sbin/clog -i -s "; + $clog_log = "%"; + + // Which logging type are we using this week?? + if(isset($config['system']['usefifolog'])) { + $log_directive = $fifolog_log; + $log_create_directive = $fifolog_create; + } else { // Defaults to CLOG + $log_directive = $clog_log; + $log_create_directive = $clog_create; + } + if (isset($syslogcfg)) { $separatelogfacilities = array('ntpd','racoon','openvpn'); if($config['installedpackages']['package']) { @@ -360,8 +375,8 @@ function system_syslogd_start() { $pkgfacilities[] = $package['logging']['facilityname']; $separatelogfacilities = $separatelogfacilities + $pkgfacilities; $facilitylist = implode(',', $pkgfacilities); - mwexec("fifolog_create -s 10240 {$g['varlog_path']}/{$package['logging']['logfilename']}"); - $syslogconf .= "!{$facilitylist}\n*.*\t\t\t\t\t\t |/usr/sbin/fifolog_writer {$g['varlog_path']}/{$package['logging']['logfilename']}\n"; + mwexec("{$log_create_directive} 10240 {$g['varlog_path']}/{$package['logging']['logfilename']}"); + $syslogconf .= "!{$facilitylist}\n*.*\t\t\t\t\t\t {$log_directive} {$g['varlog_path']}/{$package['logging']['logfilename']}\n"; } } } @@ -374,30 +389,30 @@ function system_syslogd_start() { } $syslogconf .= "!ntpdate,!ntpd\n"; if (!isset($syslogcfg['disablelocallogging'])) - $syslogconf .= "*.* |/usr/sbin/fifolog_writer {$g['varlog_path']}/ntpd.log\n"; + $syslogconf .= "*.* {$log_directive} {$g['varlog_path']}/ntpd.log\n"; $syslogconf .= "!racoon\n"; if (!isset($syslogcfg['disablelocallogging'])) - $syslogconf .= "*.* |/usr/sbin/fifolog_writer {$g['varlog_path']}/ipsec.log\n"; + $syslogconf .= "*.* {$log_directive} {$g['varlog_path']}/ipsec.log\n"; if (isset($syslogcfg['vpn'])) $syslogconf .= "*.* @{$syslogcfg['remoteserver']}\n"; $syslogconf .= "!openvpn\n"; if (!isset($syslogcfg['disablelocallogging'])) - $syslogconf .= "*.* |/usr/sbin/fifolog_writer {$g['varlog_path']}/openvpn.log\n"; + $syslogconf .= "*.* {$log_directive} {$g['varlog_path']}/openvpn.log\n"; if (isset($syslogcfg['vpn'])) $syslogconf .= "*.* @{$syslogcfg['remoteserver']}\n"; $syslogconf .= "!-{$facilitylist}\n"; if (!isset($syslogcfg['disablelocallogging'])) $syslogconf .= <<