array("name" => "General", "shortcut" => ""), "dhcpd" => array("name" => "DHCP", "shortcut" => "dhcp"), "portalauth" => array("name" => "Captive Portal Authentication", "shortcut" => "captiveportal"), "ipsec" => array("name" => "IPsec", "shortcut" => "ipsec"), "ppp" => array("name" => "PPP", "shortcut" => ""), "relayd" => array("name" => "Load Balancer", "shortcut" => "relayd"), "openvpn" => array("name" => "OpenVPN", "shortcut" => "openvpn"), "ntpd" => array("name" => "NTPd", "shortcut" => "ntp"), "gateways" => array("name" => "Gateways", "shortcut" => "gateways"), "routing" => array("name" => "Routing", "shortcut" => "routing"), "resolver" => array("name" => "DNS Resolver", "shortcut" => "resolver"), "wireless" => array("name" => "Wireless", "shortcut" => "wireless"), ); // The logs to display are specified in a GET argument. Default to 'system' logs if (!$_GET['logfile']) { $logfile = 'system'; } else { $logfile = $_GET['logfile']; if (!array_key_exists($logfile, $allowed_logs)) { /* Do not let someone attempt to load an unauthorized log. */ $logfile = 'system'; } } $system_logfile = "{$g['varlog_path']}/" . basename($logfile) . ".log"; $nentries = $config['syslog']['nentries']; if (!$nentries) { $nentries = 50; } if ($_POST['clear']) { clear_log_file($system_logfile); } if ($_GET['filtertext']) { $filtertext = htmlspecialchars($_GET['filtertext']); } if ($_POST['filtertext']) { $filtertext = htmlspecialchars($_POST['filtertext']); } if ($filtertext) { $filtertextmeta="?filtertext=$filtertext"; } /* Setup shortcuts if they exist */ if (!empty($allowed_logs[$logfile]["shortcut"])) { $shortcut_section = $allowed_logs[$logfile]["shortcut"]; } $pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"])); include("head.inc"); $tab_array = array(); $tab_array[] = array(gettext("System"), ($logfile == 'system'), "diag_logs.php"); $tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php"); $tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "diag_logs.php?logfile=dhcpd"); $tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "diag_logs.php?logfile=portalauth"); $tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "diag_logs.php?logfile=ipsec"); $tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "diag_logs.php?logfile=ppp"); $tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php"); $tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "diag_logs.php?logfile=relayd"); $tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "diag_logs.php?logfile=openvpn"); $tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "diag_logs.php?logfile=ntpd"); $tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php"); display_top_tabs($tab_array); $tab_array = array(); if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) { $tab_array[] = array(gettext("General"), ($logfile == 'system'), "/diag_logs.php"); $tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/diag_logs.php?logfile=gateways"); $tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/diag_logs.php?logfile=routing"); $tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/diag_logs.php?logfile=resolver"); $tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/diag_logs.php?logfile=wireless"); display_top_tabs($tab_array, false, 'nav nav-tabs'); } $form = new Form(false); $section = new Form_Section('Log file filter'); $section->addInput(new Form_Input( 'filtertext', 'Filter', 'text', $filtertext, ['placeholder' => 'Filter text'] )); $btnsubmit = new Form_Button( 'filtersubmit', 'Filter', null, 'fa-filter' ); $btnsubmit->removeClass('btn-primary')->addClass('btn-success')->addClass('btn-sm'); $btnclear = new Form_Button( 'clear', 'Clear log', null, 'fa-trash' ); $btnclear->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm'); $section->addInput(new Form_StaticText( '', $btnsubmit . $btnclear )); $form->add($section); print $form; if ($logfile == 'dhcpd') print_info_box('Warning: Clearing the log file will restart the DHCP daemon.'); ?>