Jettison clog and replace with fifolog which is included in FreeBSD 7.1

This commit is contained in:
Scott Ullrich 2009-03-15 19:00:47 -04:00
parent 57dc255688
commit 57ecd9b6c7
18 changed files with 35 additions and 41 deletions

View File

@ -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");

View File

@ -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";
}
}

22
etc/rc
View File

@ -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 "."

View File

@ -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();
}

View File

@ -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}");
}
}

View File

@ -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}");
}
}

View File

@ -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();

View File

@ -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();

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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();
}
}

View File

@ -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);

View File

@ -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;

View File

@ -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 "<!-- /usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail} -->";
*/
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 "<tr valign=\"top\">\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 "<!-- /usr/sbin/clog {$logfile}{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n {$tail} -->";
*/
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);
}

View File

@ -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");

View File

@ -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();

View File

@ -112,7 +112,7 @@ else
</tr>
<tr>
<td align="right">
Show how many words from story:
Show how many characters from story:
</td>
<td>
<select name='rsswidgettextlength' id='rsswidgettextlength'>
@ -154,8 +154,8 @@ else
mkdir("/tmp/simplepie");
mkdir("/tmp/simplepie/cache");
}
exec("chmod a+rw/tmp/simplepie/.");
exec("chmod a+rw/tmp/simplepie/cache/.");
exec("chmod a+rw /tmp/simplepie/.");
exec("chmod a+rw /tmp/simplepie/cache/.");
$counter = 1;
foreach($feed->get_items() as $item) {
$feed = $item->get_feed();