diff options
author | jim-p <jimp@pfsense.org> | 2015-12-17 12:08:12 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2015-12-17 12:09:04 -0500 |
commit | 41df62c1b6d32245442b59505e065370cd052b59 (patch) | |
tree | a838597db9f64af35e318dba58a0a0cf07e70022 /src/etc | |
parent | 1d60756968841c76c43e843fb05107635e541726 (diff) | |
download | pfsense-41df62c1b6d32245442b59505e065370cd052b59.zip pfsense-41df62c1b6d32245442b59505e065370cd052b59.tar.gz |
Nuke fifolog support. It was never used or fully implemented, no GUI option, and didn't end up working out.
It buffered writes too long, users could never see the most current log data.
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/filter_log.inc | 6 | ||||
-rw-r--r-- | src/etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/system.inc | 43 | ||||
-rw-r--r-- | src/etc/inc/upgrade_config.inc | 7 | ||||
-rwxr-xr-x | src/etc/rc | 10 |
5 files changed, 46 insertions, 22 deletions
diff --git a/src/etc/inc/filter_log.inc b/src/etc/inc/filter_log.inc index 7d00534..32ba9da 100644 --- a/src/etc/inc/filter_log.inc +++ b/src/etc/inc/filter_log.inc @@ -134,11 +134,7 @@ function conv_log_filter($logfile, $nentries, $tail = 50, $filtertext = "", $fil # Get a bunch of log entries. - if (isset($config['system']['usefifolog'])) { - exec("/usr/sbin/fifolog_reader " . escapeshellarg($logfile) . " | /usr/bin/grep -E $pattern | /usr/bin/tail -r -n {$tail}", $logarr); - } else { - exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | /usr/bin/grep -v \"CLOG\" | /usr/bin/grep -v \"\033\" | /usr/bin/grep -E $pattern | /usr/bin/tail -r -n {$tail}", $logarr); - } + exec("/usr/local/sbin/clog " . escapeshellarg($logfile) . " | /usr/bin/grep -v \"CLOG\" | /usr/bin/grep -v \"\033\" | /usr/bin/grep -E $pattern | /usr/bin/tail -r -n {$tail}", $logarr); # Remove escapes and fix up the pattern for preg_match. diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc index 56ad540..a1fd43d 100644 --- a/src/etc/inc/globals.inc +++ b/src/etc/inc/globals.inc @@ -96,7 +96,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "13.1", + "latest_config" => "13.2", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc index 01189c9..c125bc2 100644 --- a/src/etc/inc/system.inc +++ b/src/etc/inc/system.inc @@ -792,6 +792,41 @@ function system_syslogd_get_remote_servers($syslogcfg, $facility = "*.*") { return $remote_servers; } +function clear_log_file($logfile = "/var/log/system.log", $restart_syslogd = true) { + global $config, $g; + if ($restart_syslogd) { + exec("/usr/bin/killall syslogd"); + } + if (isset($config['system']['disablesyslogclog'])) { + unlink($logfile); + touch($logfile); + } else { + $log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "511488"; + $log_size = isset($config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize']) ? $config['syslog'][basename($logfile, '.log') . '_settings']['logfilesize'] : $log_size; + exec("/usr/local/sbin/clog -i -s {$log_size} " . escapeshellarg($logfile)); + } + if ($restart_syslogd) { + system_syslogd_start(); + } +} + +function clear_all_log_files($restart = false) { + global $g; + exec("/usr/bin/killall syslogd"); + + $log_files = array("system", "filter", "dhcpd", "vpn", "pptps", "poes", "l2tps", "openvpn", "portalauth", "ipsec", "ppp", "relayd", "wireless", "lighttpd", "ntpd", "gateways", "resolver", "routing"); + foreach ($log_files as $lfile) { + clear_log_file("{$g['varlog_path']}/{$lfile}.log", false); + } + + if ($restart) { + system_syslogd_start(); + killbyname("dhcpd"); + services_dhcpd_configure(); + } + return; +} + function system_syslogd_start() { global $config, $g; if (isset($config['system']['developerspew'])) { @@ -807,19 +842,11 @@ function system_syslogd_start() { echo gettext("Starting syslog..."); } - if (is_process_running("fifolog_writer")) { - mwexec('/bin/pkill fifolog_writer'); - } - // Which logging type are we using this week?? if (isset($config['system']['disablesyslogclog'])) { $log_directive = ""; $log_create_directive = "/usr/bin/touch "; $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 $log_directive = "%"; $log_size = isset($config['syslog']['logfilesize']) ? $config['syslog']['logfilesize'] : "10240"; diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 05088a9..45cc76c 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -4188,4 +4188,11 @@ function upgrade_130_to_131() { } } +function upgrade_131_to_132() { + global $config; + if (isset($config['system']['usefifolog'])) { + unset($config['system']['usefifolog']); + clear_all_log_files(false); + } +} ?> @@ -308,7 +308,6 @@ trap "echo 'Reboot interrupted'; exit 1" 3 echo -n "." DISABLESYSLOGCLOG=$(/usr/local/sbin/read_xml_tag.sh boolean system/disablesyslogclog) -ENABLEFIFOLOG=$(/usr/local/sbin/read_xml_tag.sh boolean system/usefifolog) LOG_FILES="system filter dhcpd vpn pptps poes l2tps openvpn portalauth ipsec ppp relayd wireless lighttpd ntpd gateways resolver routing" DEFAULT_LOG_FILE_SIZE=$(/usr/local/sbin/read_xml_tag.sh string syslog/logfilesize) @@ -319,17 +318,12 @@ for logfile in $LOG_FILES; do /usr/bin/touch /var/log/$logfile.log else if [ ! -f /var/log/$logfile.log ]; then - if [ "$ENABLEFIFOLOG" = "true" ]; then - # 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 + /usr/local/sbin/clog -i -s ${DEFAULT_LOG_FILE_SIZE} /var/log/$logfile.log fi fi done -# change permissions on newly created fifolog files. +# change permissions on newly created log files. /bin/chmod 0600 /var/log/*.log echo -n "." |