Commit a2af9837 authored by Franco Fichtner's avatar Franco Fichtner

src: purge long gone fifolog support

parent 8d65afe8
...@@ -49,10 +49,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil ...@@ -49,10 +49,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = '', $fil
/* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */ /* Always do a reverse tail, to be sure we're grabbing the 'end' of the log. */
$logarr = ""; $logarr = "";
if(isset($config['system']['usefifolog'])) exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr);
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . " | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr);
else
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/grep 'filterlog:' | /usr/bin/tail -r -n {$tail}", $logarr);
$filterlog = array(); $filterlog = array();
$counter = 0; $counter = 0;
......
...@@ -633,18 +633,11 @@ function system_syslogd_start() ...@@ -633,18 +633,11 @@ function system_syslogd_start()
if (file_exists("/var/run/booting")) if (file_exists("/var/run/booting"))
echo gettext("Starting syslog..."); echo gettext("Starting syslog...");
if (is_process_running("fifolog_writer"))
mwexec('/bin/pkill fifolog_writer');
// Which logging type are we using this week?? // Which logging type are we using this week??
if (isset($config['system']['disablesyslogclog'])) { if (isset($config['system']['disablesyslogclog'])) {
$log_directive = ""; $log_directive = "";
$log_create_directive = "/usr/bin/touch "; $log_create_directive = "/usr/bin/touch ";
$log_size = ""; $log_size = "";
} else if (isset($config['system']['usefifolog'])) {
$log_directive = "|/usr/sbin/fifolog_writer ";
$log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "10240";
$log_create_directive = "/usr/sbin/fifolog_create -s ";
} else { // Defaults to CLOG } else { // Defaults to CLOG
$log_directive = "%"; $log_directive = "%";
$log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "10240"; $log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "10240";
......
...@@ -185,7 +185,6 @@ chmod 1777 /tmp ...@@ -185,7 +185,6 @@ chmod 1777 /tmp
echo -n "." echo -n "."
DISABLESYSLOGCLOG=`/usr/bin/grep -c disablesyslogclog /conf/config.xml` DISABLESYSLOGCLOG=`/usr/bin/grep -c disablesyslogclog /conf/config.xml`
ENABLEFIFOLOG=`/usr/bin/grep -c usefifolog /conf/config.xml`
LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppps relayd wireless lighttpd ntpd gateways resolver routing" LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppps relayd wireless lighttpd ntpd gateways resolver routing"
DEFAULT_LOG_FILE_SIZE=`/usr/local/bin/xmllint --xpath 'string(//opnsense/syslog/logfilesize)' /conf/config.xml` DEFAULT_LOG_FILE_SIZE=`/usr/local/bin/xmllint --xpath 'string(//opnsense/syslog/logfilesize)' /conf/config.xml`
...@@ -195,22 +194,15 @@ fi ...@@ -195,22 +194,15 @@ fi
for logfile in $LOG_FILES; do for logfile in $LOG_FILES; do
if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then if [ "$DISABLESYSLOGCLOG" -gt "0" ]; then
/usr/bin/touch /var/log/$logfile.log touch /var/log/$logfile.log
else else
if [ ! -f /var/log/$logfile.log ]; then if [ ! -f /var/log/$logfile.log ]; then
if [ "$ENABLEFIFOLOG" -gt "0" ]; then clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
# generate fifolog files
/usr/sbin/fifolog_create -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
else
/usr/local/sbin/clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log
fi
fi fi
fi fi
chmod 0600 /var/log/$logfile.log
done done
# change permissions on newly created fifolog files.
chmod 0600 /var/log/*.log
echo -n "." echo -n "."
/sbin/ldconfig -elf /usr/lib /usr/local/lib /lib /sbin/ldconfig -elf /usr/lib /usr/local/lib /lib
/etc/rc.d/ldconfig start 2>/dev/null /etc/rc.d/ldconfig start 2>/dev/null
......
...@@ -75,10 +75,7 @@ function dump_clog_vpn($logfile, $tail) { ...@@ -75,10 +75,7 @@ function dump_clog_vpn($logfile, $tail) {
$logarr = ""; $logarr = "";
if(isset($config['system']['usefifolog'])) exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr);
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr);
else
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | tail {$sor} -n " . $tail, $logarr);
foreach ($logarr as $logent) { foreach ($logarr as $logent) {
$logent = preg_split("/\s+/", $logent, 6); $logent = preg_split("/\s+/", $logent, 6);
......
...@@ -483,7 +483,8 @@ function update_changedesc($update) { ...@@ -483,7 +483,8 @@ function update_changedesc($update) {
$changecount++; $changecount++;
} }
function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = true) { function clear_log_file($logfile = '/var/log/system.log', $restart_syslogd = true)
{
global $config, $g; global $config, $g;
if ($restart_syslogd) if ($restart_syslogd)
exec("/usr/bin/killall syslogd"); exec("/usr/bin/killall syslogd");
...@@ -492,13 +493,11 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru ...@@ -492,13 +493,11 @@ function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = tru
touch($logfile); touch($logfile);
} else { } else {
$log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488"; $log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488";
if(isset($config['system']['usefifolog'])) exec("/usr/local/sbin/clog -i -s {$log_size} " . escapeshellarg($logfile));
exec("/usr/sbin/fifolog_create -s {$log_size} " . escapeshellarg($logfile));
else
exec("/usr/local/sbin/clog -i -s {$log_size} " . escapeshellarg($logfile));
} }
if ($restart_syslogd) if ($restart_syslogd) {
system_syslogd_start(); system_syslogd_start();
}
} }
function clear_all_log_files() function clear_all_log_files()
...@@ -536,27 +535,18 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert ...@@ -536,27 +535,18 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
if($config['system']['disablesyslogclog']) { if($config['system']['disablesyslogclog']) {
exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} else { } else {
if(isset($config['system']['usefifolog'])) exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
else
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} }
} }
foreach ($logarr as $logent) { foreach ($logarr as $logent) {
$logent = preg_split("/\s+/", $logent, 6); $logent = preg_split("/\s+/", $logent, 6);
echo "<tr valign=\"top\">\n"; echo "<tr valign=\"top\">\n";
if ($withorig) { if ($withorig) {
if(isset($config['system']['usefifolog'])) { $entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
$entry_date_time = htmlspecialchars(date("F j, Y, g:i a","" . $logent[1] . "")); $entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " ";
$entry_text = htmlspecialchars($logent[5]); $entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]);
} else {
$entry_date_time = htmlspecialchars(join(" ", array_slice($logent, 0, 3)));
$entry_text = ($logent[3] == $config['system']['hostname']) ? "" : $logent[3] . " ";
$entry_text .= htmlspecialchars($logent[4] . " " . $logent[5]);
}
echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n"; echo "<td class=\"listlr nowrap\">{$entry_date_time}</td>\n";
echo "<td class=\"listr\">{$entry_text}</td>\n"; echo "<td class=\"listr\">{$entry_text}</td>\n";
} else { } else {
echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n"; echo "<td class=\"listlr\" colspan=\"2\">" . htmlspecialchars($logent[5]) . "</td>\n";
} }
...@@ -576,11 +566,7 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve ...@@ -576,11 +566,7 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve
if($config['system']['disablesyslogclog']) { if($config['system']['disablesyslogclog']) {
exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr); exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} else { } else {
if(isset($config['system']['usefifolog'])) { exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} else {
exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . "{$grepline}| grep -v \"CLOG\" | grep -v \"\033\" | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
}
} }
return($logarr); return($logarr);
} }
......
...@@ -162,13 +162,8 @@ defCmdT("ipsec.conf","cat /usr/local/etc/ipsec.conf"); ...@@ -162,13 +162,8 @@ defCmdT("ipsec.conf","cat /usr/local/etc/ipsec.conf");
defCmdT("SPD","/sbin/setkey -DP"); defCmdT("SPD","/sbin/setkey -DP");
defCmdT("SAD","/sbin/setkey -D"); defCmdT("SAD","/sbin/setkey -D");
if(isset($config['system']['usefifolog'])) { defCmdT("last 200 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200");
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/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50");
defCmdT("last 50 filter log entries","/usr/sbin/fifolog_reader /var/log/filter.log 2>&1 | tail -n 50");
} else {
defCmdT("last 200 system log entries","/usr/local/sbin/clog /var/log/system.log 2>&1 | tail -n 200");
defCmdT("last 50 filter log entries","/usr/local/sbin/clog /var/log/filter.log 2>&1 | tail -n 50");
}
defCmd("ls /conf"); defCmd("ls /conf");
defCmd("ls /var/run"); defCmd("ls /var/run");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment