Commit b91de022 authored by Franco Fichtner's avatar Franco Fichtner

logs: provide access to the access log as well for proxy

Switch to GET for now, I think other pages use a mix of POST and GET
in case of 'clear' which doesn't clear the right log for obvious
reasons...
parent 44edcd0c
......@@ -264,7 +264,9 @@
<LoadBalancer url="/diag_logs_relayd.php"/>
<OpenVPN url="/diag_logs_openvpn.php"/>
<NTP url="/diag_logs_ntpd.php"/>
<Proxy url="/diag_logs_proxy.php"/>
<Proxy url="/diag_logs_proxy.php">
<ProxyActions url="/diag_logs_proxy.php?*"/>
</Proxy>
<Settings url="/diag_logs_settings.php"/>
</SystemLogs>
......
......@@ -30,37 +30,20 @@ $tab_group = isset($tab_group) ? $tab_group : 'system';
$tab_array = array();
if ($tab_group == 'vpn') {
$tab_array[] = array(gettext("PPTP Logins"),
(($vpntype == "pptp") && ($mode != "raw")),
"/diag_logs_vpn.php?vpntype=pptp");
$tab_array[] = array(gettext("PPTP Raw"),
(($vpntype == "pptp") && ($mode == "raw")),
"/diag_logs_vpn.php?vpntype=pptp&amp;mode=raw");
$tab_array[] = array(gettext("PPPoE Logins"),
(($vpntype == "poes") && ($mode != "raw")),
"/diag_logs_vpn.php?vpntype=poes");
$tab_array[] = array(gettext("PPPoE Raw"),
(($vpntype == "poes") && ($mode == "raw")),
"/diag_logs_vpn.php?vpntype=poes&amp;mode=raw");
$tab_array[] = array(gettext("L2TP Logins"),
(($vpntype == "l2tp") && ($mode != "raw")),
"/diag_logs_vpn.php?vpntype=l2tp");
$tab_array[] = array(gettext("L2TP Raw"),
(($vpntype == "l2tp") && ($mode == "raw")),
"/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
}
else if ($tab_group == 'firewall') {
$tab_array[] = array(gettext("PPTP Logins"), (($vpntype == "pptp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=pptp");
$tab_array[] = array(gettext("PPTP Raw"), (($vpntype == "pptp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=pptp&amp;mode=raw");
$tab_array[] = array(gettext("PPPoE Logins"), (($vpntype == "poes") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=poes");
$tab_array[] = array(gettext("PPPoE Raw"), (($vpntype == "poes") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=poes&amp;mode=raw");
$tab_array[] = array(gettext("L2TP Logins"), (($vpntype == "l2tp") && ($mode != "raw")), "/diag_logs_vpn.php?vpntype=l2tp");
$tab_array[] = array(gettext("L2TP Raw"), (($vpntype == "l2tp") && ($mode == "raw")), "/diag_logs_vpn.php?vpntype=l2tp&amp;mode=raw");
} elseif ($tab_group == 'firewall') {
$tab_array[] = array(gettext("Normal View"), true, "/diag_logs_filter.php");
$tab_array[] = array(gettext("Dynamic View"), false, "/diag_logs_filter_dynamic.php");
$tab_array[] = array(gettext("Summary View"), false, "/diag_logs_filter_summary.php");
}
else {
} elseif ($tab_group == 'proxy') {
$tab_array[] = array(gettext('Cache'), true, '/diag_logs_proxy.php?type=cache');
$tab_array[] = array(gettext('Access'), false, '/diag_logs_proxy.php?type=access');
} else {
$tab_array[] = array(gettext("General"), true, "/diag_logs.php");
$tab_array[] = array(gettext("Gateways"), false, "/diag_logs_gateways.php");
$tab_array[] = array(gettext("Routing"), false, "/diag_logs_routing.php");
......@@ -68,8 +51,8 @@ else {
$tab_array[] = array(gettext("Wireless"), false, "/diag_logs_wireless.php");
}
?>
<ul class="nav nav-pills __mb" role="tablist"><? foreach ($tab_array as $tab): ?>
?><ul class="nav nav-pills __mb" role="tablist">
<? foreach ($tab_array as $tab): ?>
<li role="presentation" <? if (str_replace('amp;','', $tab[2]) == $_SERVER['REQUEST_URI']):?>class="active"<? endif; ?>><a href="<?=$tab[2];?>"><?=$tab[0];?></a></li>
<? endforeach; ?></ul>
<? endforeach; ?>
</ul>
......@@ -29,15 +29,20 @@
require_once("guiconfig.inc");
require_once("system.inc");
$logfile = '/var/log/squid/cache.log';
if (empty($config['syslog']['nentries'])) {
$nentries = 50;
} else {
$nentries = $config['syslog']['nentries'];
}
if ($_POST['clear']) {
$type = 'cache';
if (isset($_GET['type']) && $_GET['type'] === 'access') {
$type = $_GET['type'];
}
$logfile = "/var/log/squid/{$type}.log";
if (isset($_GET['clear'])) {
clear_log($logfile);
}
......@@ -53,17 +58,19 @@ include("head.inc");
<div class="container-fluid">
<div class="row">
<section class="col-xs-12">
<? include('diag_logs_tabs.inc'); ?>
<?php include('diag_logs_tabs.inc'); ?>
<div class="tab-content content-box col-xs-12">
<div class="container-fluid">
<?php $tab_group = 'proxy'; include('diag_logs_pills.inc'); ?>
<p><?php printf(gettext("Last %s Proxy log entries"), $nentries);?></p>
<div class="table-responsive">
<table class="table table-striped table-sort">
<?php dump_log($logfile, $nentries); ?>
</table>
</div>
<form method="post">
<form method="get">
<input name="clear" type="submit" class="btn" value="<?= gettext("Clear log");?>" />
<input name="type" type="hidden" value="<?= $type ?>" />
</form>
</div>
</div>
......
......@@ -38,6 +38,6 @@ $tab_array[] = array(gettext("VPN"), $active_tab == "/diag_logs_vpn.php", "diag_
$tab_array[] = array(gettext("Load Balancer"), $active_tab == "/diag_logs_relayd.php", "diag_logs_relayd.php");
$tab_array[] = array(gettext("OpenVPN"), $active_tab == "/diag_logs_openvpn.php", "diag_logs_openvpn.php");
$tab_array[] = array(gettext("NTP"), $active_tab == "/diag_logs_ntpd.php", "diag_logs_ntpd.php");
$tab_array[] = array(gettext("Proxy"), $active_tab == "/diag_logs_proxy.php", "diag_logs_proxy.php");
$tab_array[] = array(gettext("Proxy"), $active_tab == "/diag_logs_proxy.php", "diag_logs_proxy.php?type=cache");
$tab_array[] = array(gettext("Settings"), $active_tab == "/diag_logs_settings.php", "diag_logs_settings.php");
display_top_tabs($tab_array);
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