From 57ecd9b6c79b8755654fd192e4e3cc6d1ec6ade3 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Sun, 15 Mar 2009 19:00:47 -0400 Subject: [PATCH] Jettison clog and replace with fifolog which is included in FreeBSD 7.1 --- etc/inc/pkg-utils.inc | 2 +- etc/inc/system.inc | 2 +- etc/rc | 22 ++++++++++---------- usr/local/www/diag_logs.php | 2 +- usr/local/www/diag_logs_auth.php | 2 +- usr/local/www/diag_logs_dhcp.php | 2 +- usr/local/www/diag_logs_filter.php | 4 ++-- usr/local/www/diag_logs_filter_dynamic.php | 4 ++-- usr/local/www/diag_logs_ipsec.php | 2 +- usr/local/www/diag_logs_ntpd.php | 2 +- usr/local/www/diag_logs_relayd.php | 2 +- usr/local/www/diag_logs_slbd.php | 2 +- usr/local/www/diag_logs_vpn.php | 4 ++-- usr/local/www/diag_pkglogs.php | 2 +- usr/local/www/guiconfig.inc | 10 ++------- usr/local/www/status.php | 4 ++-- usr/local/www/widgets/include/log.inc | 2 +- usr/local/www/widgets/widgets/rss.widget.php | 6 +++--- 18 files changed, 35 insertions(+), 41 deletions(-) diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index aceeb07fe9..400f251dea 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -487,7 +487,7 @@ function install_package_xml($pkg) { /* set up package logging streams */ if($pkg_info['logging']) { - mwexec("/usr/sbin/clog -i -s 32768 {$g['varlog_path']}/{$pkg_info['logging']['logfilename']}"); + mwexec("/usr/sbin/fifolog_create -s 32768 {$g['varlog_path']}/{$pkg_info['logging']['logfilename']}"); chmod($g['varlog_path'] . '/' . $pkg_info['logging']['logfilename'], 0600); @fwrite($fd_log, "Adding text to file /etc/syslog.conf\n"); mwexec("killall syslogd"); diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 5c061b6f03..0ae3a52300 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -352,7 +352,7 @@ function system_syslogd_start() { $pkgfacilities[] = $package['logging']['facilityname']; $separatelogfacilities = $separatelogfacilities + $pkgfacilities; $facilitylist = implode(',', $pkgfacilities); - mwexec("clog -i -s 10000 {$g['varlog_path']}/{$package['logging']['logfilename']}"); + mwexec("fifolog_create -s 10000 {$g['varlog_path']}/{$package['logging']['logfilename']}"); $syslogconf .= "!{$facilitylist}\n*.*\t\t\t\t\t\t%{$g['varlog_path']}/{$package['logging']['logfilename']}\n"; } } diff --git a/etc/rc b/etc/rc index ef9250e9c1..d064d2f567 100755 --- a/etc/rc +++ b/etc/rc @@ -217,18 +217,18 @@ if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then touch /var/log/ntpd.log else # generate circular logfiles - clog -i -s 512144 /var/log/system.log - clog -i -s 512144 /var/log/filter.log - clog -i -s 65535 /var/log/dhcpd.log - clog -i -s 65535 /var/log/vpn.log - clog -i -s 65535 /var/log/openvpn.log - clog -i -s 65535 /var/log/portalauth.log - clog -i -s 65535 /var/log/ipsec.log - clog -i -s 65535 /var/log/relayd.log - clog -i -s 65535 /var/log/lighttpd.log - clog -i -s 65535 /var/log/ntpd.log + fifolog_create -s 512144 /var/log/system.log + fifolog_create -s 512144 /var/log/filter.log + fifolog_create -s 65535 /var/log/dhcpd.log + fifolog_create -s 65535 /var/log/vpn.log + fifolog_create -s 65535 /var/log/openvpn.log + fifolog_create -s 65535 /var/log/portalauth.log + fifolog_create -s 65535 /var/log/ipsec.log + fifolog_create -s 65535 /var/log/relayd.log + fifolog_create -s 65535 /var/log/lighttpd.log + fifolog_create -s 65535 /var/log/ntpd.log fi -# change permissions on newly created clog files. +# change permissions on newly created fifolog files. chmod 0600 /var/log/system.log /var/log/filter.log /var/log/dhcpd.log /var/log/vpn.log /var/log/portalauth.log /var/log/relayd.log echo -n "." diff --git a/usr/local/www/diag_logs.php b/usr/local/www/diag_logs.php index 42f4956153..b97a3b04a2 100755 --- a/usr/local/www/diag_logs.php +++ b/usr/local/www/diag_logs.php @@ -55,7 +55,7 @@ if ($_POST['clear']) { system_syslogd_start(); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 {$system_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$system_logfile}"); system_syslogd_start(); } diff --git a/usr/local/www/diag_logs_auth.php b/usr/local/www/diag_logs_auth.php index 4ac9f8f039..3db4eeb88c 100755 --- a/usr/local/www/diag_logs_auth.php +++ b/usr/local/www/diag_logs_auth.php @@ -50,7 +50,7 @@ if ($_POST['clear']) { unlink($portal_logfile); touch($portal_logfile); } else { - exec("/usr/sbin/clog -i -s 262144 {$portal_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$portal_logfile}"); } } diff --git a/usr/local/www/diag_logs_dhcp.php b/usr/local/www/diag_logs_dhcp.php index e53785775b..3573183182 100755 --- a/usr/local/www/diag_logs_dhcp.php +++ b/usr/local/www/diag_logs_dhcp.php @@ -52,7 +52,7 @@ if ($_POST['clear']) { unlink($dhcpd_logfile); touch($dhcpd_logfile); } else { - exec("/usr/sbin/clog -i -s 262144 {$dhcpd_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$dhcpd_logfile}"); } } diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php index 54c4f074ac..daa9598675 100755 --- a/usr/local/www/diag_logs_filter.php +++ b/usr/local/www/diag_logs_filter.php @@ -61,7 +61,7 @@ if ($_POST['clear']) { touch("/var/log/filter.log"); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 512144 /var/log/filter.log"); + exec("/usr/sbin/fifolog_create -s 512144 /var/log/filter.log"); system_syslogd_start(); } } @@ -78,7 +78,7 @@ function conv_clog($logfile, $tail = 50) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; - exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n 500", $logarr); + exec("/usr/sbin/fifolog_reader {$logfile} | /usr/bin/tail {$sor} -n 500", $logarr); $filterlog = array(); diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php index 21511ec294..ffc91d9799 100755 --- a/usr/local/www/diag_logs_filter_dynamic.php +++ b/usr/local/www/diag_logs_filter_dynamic.php @@ -54,7 +54,7 @@ if ($_POST['clear']) { touch("/var/log/filter.log"); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 /var/log/filter.log"); + exec("/usr/sbin/fifolog_create -s 262144 /var/log/filter.log"); system_syslogd_start(); } } @@ -72,7 +72,7 @@ function conv_clog_filter($logfile, $tail = 50) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; $logarr = ""; - exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr); + exec("/usr/sbin/fifolog_reader {$logfile} | /usr/bin/tail {$sor} -n {$tail}", $logarr); $filterlog = array(); diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php index 15f8fcdd1a..58a4372226 100755 --- a/usr/local/www/diag_logs_ipsec.php +++ b/usr/local/www/diag_logs_ipsec.php @@ -69,7 +69,7 @@ if ($_POST['clear']) { touch($ipsec_logfile); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 {$ipsec_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$ipsec_logfile}"); system_syslogd_start(); } } diff --git a/usr/local/www/diag_logs_ntpd.php b/usr/local/www/diag_logs_ntpd.php index 0e8251c317..10d751770f 100644 --- a/usr/local/www/diag_logs_ntpd.php +++ b/usr/local/www/diag_logs_ntpd.php @@ -51,7 +51,7 @@ if ($_POST['clear']) { touch($ntpd_logfile); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 {$ntpd_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$ntpd_logfile}"); system_syslogd_start(); } } diff --git a/usr/local/www/diag_logs_relayd.php b/usr/local/www/diag_logs_relayd.php index 4f5be4b651..f2b0c50ba5 100755 --- a/usr/local/www/diag_logs_relayd.php +++ b/usr/local/www/diag_logs_relayd.php @@ -52,7 +52,7 @@ if ($_POST['clear']) { touch($relayd_logfile); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 {$relayd_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$relayd_logfile}"); system_syslogd_start(); } } diff --git a/usr/local/www/diag_logs_slbd.php b/usr/local/www/diag_logs_slbd.php index 066c6f8435..7e6feba470 100755 --- a/usr/local/www/diag_logs_slbd.php +++ b/usr/local/www/diag_logs_slbd.php @@ -52,7 +52,7 @@ if ($_POST['clear']) { touch($slbd_logfile); } else { exec("killall syslogd"); - exec("/usr/sbin/clog -i -s 262144 {$slbd_logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$slbd_logfile}"); system_syslogd_start(); } } diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php index 14c9c12c60..fa545d3616 100755 --- a/usr/local/www/diag_logs_vpn.php +++ b/usr/local/www/diag_logs_vpn.php @@ -49,7 +49,7 @@ if ($_POST['clear']) { unlink("/var/log/vpn.log"); touch("/var/log/vpn.log"); } else { - exec("/usr/sbin/clog -i -s 65536 /var/log/vpn.log"); + exec("/usr/sbin/fifolog_create -s 65536 /var/log/vpn.log"); } /* redirect to avoid reposting form data on refresh */ header("Location: diag_logs_vpn.php"); @@ -62,7 +62,7 @@ function dump_clog_vpn($logfile, $tail) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; $logarr = ""; - exec("/usr/sbin/clog " . $logfile . " | tail {$sor} -n " . $tail, $logarr); + exec("/usr/sbin/fifolog_reader " . $logfile . " | tail {$sor} -n " . $tail, $logarr); foreach ($logarr as $logent) { $logent = preg_split("/\s+/", $logent, 6); diff --git a/usr/local/www/diag_pkglogs.php b/usr/local/www/diag_pkglogs.php index 5720a75164..91091ca8a7 100755 --- a/usr/local/www/diag_pkglogs.php +++ b/usr/local/www/diag_pkglogs.php @@ -51,7 +51,7 @@ require("guiconfig.inc"); if(!($nentries = $config['syslog']['nentries'])) $nentries = 50; if ($_POST['clear']) { - exec("/usr/sbin/clog -i -s 262144 {$logfile}"); + exec("/usr/sbin/fifolog_create -s 262144 {$logfile}"); } $i = 0; $pkgwithlogging = false; diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc index ee2ffd74bb..68a645d2ae 100755 --- a/usr/local/www/guiconfig.inc +++ b/usr/local/www/guiconfig.inc @@ -755,10 +755,7 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert if($config['system']['disablesyslogclog']) exec("cat {$logfile}{$grepline} | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr); else - exec("/usr/sbin/clog {$logfile}{$grepline} | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr); - /* comment out debug code - echo ""; - */ + exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr); foreach ($logarr as $logent) { $logent = preg_split("/\s+/", $logent, 6); echo "\n"; @@ -784,13 +781,10 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve if(is_array($grepinvert)) foreach($grepinvert as $agrep) $grepline .= " | grep -v \"$agrep\""; - /* comment out debug code - echo ""; - */ if($config['system']['disablesyslogclog']) exec("cat {$logfile}{$grepline} | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr); else - exec("/usr/sbin/clog {$logfile}{$grepline} | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail}", $logarr); + exec("/usr/sbin/fifolog_reader {$logfile}{$grepline} | /usr/bin/tail {$sor} -n {$tail}", $logarr); return($logarr); } diff --git a/usr/local/www/status.php b/usr/local/www/status.php index 259b5416a0..3b0e320e27 100755 --- a/usr/local/www/status.php +++ b/usr/local/www/status.php @@ -172,8 +172,8 @@ defCmdT("racoon.conf","cat /var/etc/racoon.conf"); defCmdT("SPD","/sbin/setkey -DP"); defCmdT("SAD","/sbin/setkey -D"); -defCmdT("last 200 system log entries","/usr/sbin/clog /var/log/system.log 2>&1 | tail -n 200"); -defCmdT("last 50 filter log entries","/usr/sbin/clog /var/log/filter.log 2>&1 | tail -n 50"); +defCmdT("last 200 system log entries","/usr/sbin/fifolog_reader /var/log/system.log 2>&1 | tail -n 200"); +defCmdT("last 50 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50"); defCmd("ls /conf"); defCmd("ls /var/run"); diff --git a/usr/local/www/widgets/include/log.inc b/usr/local/www/widgets/include/log.inc index 7afaba81ba..08d420507c 100644 --- a/usr/local/www/widgets/include/log.inc +++ b/usr/local/www/widgets/include/log.inc @@ -25,7 +25,7 @@ function conv_clog_filter($logfile, $tail = 8) { $sor = isset($config['syslog']['reverse']) ? "-r" : ""; - exec("/usr/sbin/clog {$logfile} | /usr/bin/tail {$sor} -n 500", $logarr); + exec("/usr/sbin/fifolog_reader {$logfile} | /usr/bin/tail {$sor} -n 500", $logarr); $filterlog = array(); diff --git a/usr/local/www/widgets/widgets/rss.widget.php b/usr/local/www/widgets/widgets/rss.widget.php index 8119565609..4a592bcb65 100644 --- a/usr/local/www/widgets/widgets/rss.widget.php +++ b/usr/local/www/widgets/widgets/rss.widget.php @@ -112,7 +112,7 @@ else - Show how many words from story: + Show how many characters from story: