summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/diag_logs.php19
-rwxr-xr-xusr/local/www/diag_logs_auth.php15
-rwxr-xr-xusr/local/www/diag_logs_dhcp.php15
-rwxr-xr-xusr/local/www/diag_logs_filter.php15
-rwxr-xr-xusr/local/www/diag_logs_filter_dynamic.php16
-rwxr-xr-xusr/local/www/diag_logs_ipsec.php15
-rw-r--r--usr/local/www/diag_logs_ntpd.php15
-rw-r--r--usr/local/www/diag_logs_openvpn.php15
-rwxr-xr-xusr/local/www/diag_logs_relayd.php15
-rwxr-xr-xusr/local/www/diag_logs_slbd.php15
-rwxr-xr-xusr/local/www/diag_logs_vpn.php18
-rwxr-xr-xusr/local/www/diag_pkglogs.php6
-rwxr-xr-xusr/local/www/guiconfig.inc15
-rwxr-xr-xusr/local/www/status_slbd_pool.php1
14 files changed, 40 insertions, 155 deletions
diff --git a/usr/local/www/diag_logs.php b/usr/local/www/diag_logs.php
index f3a1839..637ff4c 100755
--- a/usr/local/www/diag_logs.php
+++ b/usr/local/www/diag_logs.php
@@ -46,23 +46,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- exec("killall syslogd");
- unlink($syslog_logfile);
- touch($syslog_logfile);
- system_syslogd_start();
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$system_logfile}"))
-// unlink("{$system_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$system_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
-// system_syslogd_start();
-// Header("Location: diag_logs.php");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($system_logfile);
if ($_GET['filtertext'])
$filtertext = $_GET['filtertext'];
diff --git a/usr/local/www/diag_logs_auth.php b/usr/local/www/diag_logs_auth.php
index 2c0c7ef..413e223 100755
--- a/usr/local/www/diag_logs_auth.php
+++ b/usr/local/www/diag_logs_auth.php
@@ -44,19 +44,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($portal_logfile);
- touch($portal_logfile);
- } else {
-// exec("killall syslogd");
-/// sleep(1);
-// if(file_exists("{$portal_logfile}"))
-// unlink("{$portal_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$portal_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($portal_logfile);
$pgtitle = array("Status","System logs","Portal Auth");
include("head.inc");
diff --git a/usr/local/www/diag_logs_dhcp.php b/usr/local/www/diag_logs_dhcp.php
index cdca3a2..07294cf 100755
--- a/usr/local/www/diag_logs_dhcp.php
+++ b/usr/local/www/diag_logs_dhcp.php
@@ -46,19 +46,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($dhcpd_logfile);
- touch($dhcpd_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$dhcpd_logfile}"))
-// unlink("{$dhcpd_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$dhcpd_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($dhcpd_logfile);
$pgtitle = array("Status","System logs","DHCP");
include("head.inc");
diff --git a/usr/local/www/diag_logs_filter.php b/usr/local/www/diag_logs_filter.php
index 9b67549..2e4045f 100755
--- a/usr/local/www/diag_logs_filter.php
+++ b/usr/local/www/diag_logs_filter.php
@@ -55,19 +55,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- exec("/usr/bin/killall syslogd");
- if(isset($config['system']['disablesyslogclog'])) {
- unlink("/var/log/filter.log");
- touch("/var/log/filter.log");
- } else {
- if(isset($config['system']['usefifolog'])) {
- exec("/usr/sbin/fifolog_create -s 511488 {$filter_logfile}");
- } else {
- exec("/usr/sbin/clog -i -s 262144 {$filter_logfile}");
- }
- }
-}
+if ($_POST['clear'])
+ clear_log_file($filter_logfile);
/* format filter logs */
function conv_clog($logfile, $tail = 50) {
diff --git a/usr/local/www/diag_logs_filter_dynamic.php b/usr/local/www/diag_logs_filter_dynamic.php
index ec70856..54cb51f 100755
--- a/usr/local/www/diag_logs_filter_dynamic.php
+++ b/usr/local/www/diag_logs_filter_dynamic.php
@@ -47,20 +47,8 @@ if (!$nentries)
/* AJAX related routines */
handle_ajax();
-if ($_POST['clear']) {
- exec("/usr/bin/killall syslogd");
- if(isset($config['system']['disablesyslogclog'])) {
- unlink("/var/log/filter.log");
- touch("/var/log/filter.log");
- } else {
- if(isset($config['system']['usefifolog'])) {
- exec("/usr/sbin/fifolog_create -s 511488 {$filter_logfile}");
- } else {
- exec("/usr/sbin/clog -i -s 262144 {$filter_logfile}");
- }
- }
- system_syslogd_start();
-}
+if ($_POST['clear'])
+ clear_log_file($filter_logfile);
/* format filter logs */
function conv_clog_filter($logfile, $tail = 50) {
diff --git a/usr/local/www/diag_logs_ipsec.php b/usr/local/www/diag_logs_ipsec.php
index d83d895..9563753 100755
--- a/usr/local/www/diag_logs_ipsec.php
+++ b/usr/local/www/diag_logs_ipsec.php
@@ -62,19 +62,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($ipsec_logfile);
- touch($ipsec_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$ipsec_logfile}"))
-// unlink("{$ipsec_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$ipsec_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($ipsec_logfile);
$ipsec_logarr = return_clog($ipsec_logfile, $nentries);
diff --git a/usr/local/www/diag_logs_ntpd.php b/usr/local/www/diag_logs_ntpd.php
index 57a9aae..3674813 100644
--- a/usr/local/www/diag_logs_ntpd.php
+++ b/usr/local/www/diag_logs_ntpd.php
@@ -44,19 +44,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($ntpd_logfile);
- touch($ntpd_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$ntpd_logfile}"))
-// unlink("{$ntpd_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$ntpd_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($ntpd_logfile);
$pgtitle = array("Status","System logs","OpenNTPD");
include("head.inc");
diff --git a/usr/local/www/diag_logs_openvpn.php b/usr/local/www/diag_logs_openvpn.php
index fe1bafe..5fdc7a3 100644
--- a/usr/local/www/diag_logs_openvpn.php
+++ b/usr/local/www/diag_logs_openvpn.php
@@ -49,19 +49,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($openvpn_logfile);
- touch($openvpn_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$openvpn_logfile}"))
-// unlink("{$openvpn_logfile}");
- exec("/usr/sbin/fifolog_create -s 262144 {$openvpn_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($openvpn_logfile);
include("head.inc");
diff --git a/usr/local/www/diag_logs_relayd.php b/usr/local/www/diag_logs_relayd.php
index ef138e7..5d84eed 100755
--- a/usr/local/www/diag_logs_relayd.php
+++ b/usr/local/www/diag_logs_relayd.php
@@ -45,19 +45,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($relayd_logfile);
- touch($relayd_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$relayd_logfile}"))
-// unlink("{$relayd_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$relayd_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($relayd_logfile);
$pgtitle = array("Status","System logs","Load Balancer");
include("head.inc");
diff --git a/usr/local/www/diag_logs_slbd.php b/usr/local/www/diag_logs_slbd.php
index ae1a182..fb69648 100755
--- a/usr/local/www/diag_logs_slbd.php
+++ b/usr/local/www/diag_logs_slbd.php
@@ -45,19 +45,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- if(isset($config['system']['disablesyslogclog'])) {
- unlink($slbd_logfile);
- touch($slbd_logfile);
- } else {
-// exec("killall syslogd");
-// sleep(1);
-// if(file_exists("{$slbd_logfile}"))
-// unlink("{$slbd_logfile}");
- exec("/usr/sbin/fifolog_create -s 511488 {$slbd_logfile}");
- exec("/usr/bin/killall -HUP syslogd");
- }
-}
+if ($_POST['clear'])
+ clear_log_file($slbd_logfile);
$pgtitle = array("Status","System logs","Load Balancer");
include("head.inc");
diff --git a/usr/local/www/diag_logs_vpn.php b/usr/local/www/diag_logs_vpn.php
index ba21924..6f9965e 100755
--- a/usr/local/www/diag_logs_vpn.php
+++ b/usr/local/www/diag_logs_vpn.php
@@ -36,7 +36,6 @@
##|*MATCH=diag_logs_vpn.php*
##|-PRIV
-
$pgtitle = array("Status","System logs","PPTP VPN");
require("guiconfig.inc");
@@ -44,21 +43,8 @@ $nentries = $config['syslog']['nentries'];
if (!$nentries)
$nentries = 50;
-if ($_POST['clear']) {
- exec("/usr/bin/killall syslogd");
- if(isset($config['system']['disablesyslogclog'])) {
- unlink("/var/log/vpn.log");
- touch("/var/log/vpn.log");
- } else {
- if(isset($config['system']['usefifolog']))
- exec("/usr/sbin/fifolog_create -s 50688 /var/log/vpn.log");
- else
- exec("/usr/sbin/clog -i -s 262144 /var/log/vpn.log");
- }
- /* redirect to avoid reposting form data on refresh */
- header("Location: diag_logs_vpn.php");
- exit;
-}
+if ($_POST['clear'])
+ clear_log_file("/var/log/vpn.log");
function dump_clog_vpn($logfile, $tail) {
global $g, $config;
diff --git a/usr/local/www/diag_pkglogs.php b/usr/local/www/diag_pkglogs.php
index 9c77239..c39ef34 100755
--- a/usr/local/www/diag_pkglogs.php
+++ b/usr/local/www/diag_pkglogs.php
@@ -50,9 +50,9 @@ require("guiconfig.inc");
if(!($nentries = $config['syslog']['nentries'])) $nentries = 50;
-if ($_POST['clear']) {
- exec("/usr/sbin/fifolog_create -s 511488 {$logfile}");
-}
+//if ($_POST['clear'])
+// clear_log_file($logfile);
+
$i = 0;
$pkgwithlogging = false;
$apkg = $_POST['pkg'];
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index 4310c2c..2e5bf14 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -741,6 +741,21 @@ function update_changedesc($update) {
$changecount++;
}
+function clear_log_file($logfile = "/var/log/system.log") {
+ global $config, $g;
+ exec("/usr/bin/killall syslogd");
+ if(isset($config['system']['disablesyslogclog'])) {
+ unlink($logfile);
+ touch($logfile);
+ } else {
+ if(isset($config['system']['usefifolog']))
+ exec("/usr/sbin/fifolog_create -s 511488 {$logfile}");
+ else
+ exec("/usr/sbin/clog -i -s 511488 {$logfile}");
+ }
+ system_syslogd_start();
+}
+
function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert = "") {
global $g, $config;
$sor = isset($config['syslog']['reverse']) ? "-r" : "";
diff --git a/usr/local/www/status_slbd_pool.php b/usr/local/www/status_slbd_pool.php
index 782a286..fb9d615 100755
--- a/usr/local/www/status_slbd_pool.php
+++ b/usr/local/www/status_slbd_pool.php
@@ -36,7 +36,6 @@
##|*MATCH=status_slbd_pool.php*
##|-PRIV
-
require("guiconfig.inc");
if (!is_array($config['load_balancer']['lbpool'])) {
OpenPOWER on IntegriCloud