} $loginfo2 = array(array("visible" => TRUE, "desc" => gettext("Thebrig"), "logfile" => $config['thebrig']['rootfolder'] . "thebrig.log", "filename" => "thebrig.log", "type" => "plain", "pattern" => "/^(\\[\\S+\\s+\\S+\\s)([a-zA-Z]+\\s[a-zA-Z]+.+\\!\\:)(.+)/", "columns" => array(array("title" => gettext("Date & Time"), "class" => "listlr", "param" => "nowrap=\"nowrap\"", "pmid" => 1), array("title" => gettext("Who"), "class" => "listr", "param" => "nowrap=\"nowrap\"", "pmid" => 2), array("title" => gettext("Event"), "class" => "listr", "param" => "", "pmid" => 3)))); if (is_array($config['thebrig']['content'])) { $countjails = count($config['thebrig']['content']); foreach ($config['thebrig']['content'] as $jails) { $jailnames[] = $jails['jailname']; } for ($i = 0; $i < $countjails; $i++) { $loginfo1[$i] = array("visible" => TRUE, "desc" => $jailnames[$i], "logfile" => $config['thebrig']['rootfolder'] . $jailnames[$i] . "/var/log/messages", "filename" => "messages", "type" => "plain", "pattern" => "/^(\\w+\\s+\\d+\\s+\\S+)(\\s\\w+\\s\\S+)(\\:\\s.+\$)/", "columns" => array(array("title" => gettext("Date & Time"), "class" => "listlr", "param" => "nowrap=\"nowrap\"", "pmid" => 1), array("title" => gettext("Who"), "class" => "listr", "param" => "nowrap=\"nowrap\"", "pmid" => 2), array("title" => gettext("Event"), "class" => "listr", "param" => "", "pmid" => 3))); } $loginfo = array_merge_recursive($loginfo2, $loginfo1); } else { $loginfo = $loginfo2; } if (isset($_POST['clear']) && $_POST['clear']) { log_clear($loginfo[$log]); header("Location: extensions_thebrig_log.php?log={$log}"); exit; } if (isset($_POST['download']) && $_POST['download']) { log_download($loginfo[$log]); exit; } if (isset($_POST['refresh']) && $_POST['refresh']) { header("Location: extensions_thebrig_log.php?log={$log}"); exit; } function log_get_contents($logfile, $type) { $content = array(); $param = isset($config['syslogd']['reverse']) ? "-r " : "";
<?php /* extensions_dnsmasq_log.php */ require "auth.inc"; require "guiconfig.inc"; // require("diag_log.inc"); require_once "globals.inc"; require_once "rc.inc"; $loginfo = array("visible" => TRUE, "desc" => gettext("Dnsmasq Log"), "logfile" => "/var/log/dnsmasq.log", "filename" => "dnsmasq.log", "type" => "plain", "pattern" => "/^(\\S+\\s+\\d+\\s+\\S+)\\s+(\\S+\\]\\:)\\s+(.*)\$/", "columns" => array(array("title" => gettext("Date & Time"), "class" => "listlr", "param" => "nowrap=\"nowrap\"", "pmid" => 1), array("title" => gettext("Who"), "class" => "listr", "param" => "nowrap=\"nowrap\"", "pmid" => 2), array("title" => gettext("Event"), "class" => "listr", "param" => "", "pmid" => 3))); $pgtitle = array(gettext("Dnsmasq "), gettext(" Log")); if (isset($_POST['clear']) && $_POST['clear']) { log_clear($loginfo); header("Location: extensions_dnsmasq_log.php"); exit; } if (isset($_POST['download']) && $_POST['download']) { log_download($loginfo); exit; } if (isset($_POST['refresh']) && $_POST['refresh']) { header("Location: extensions_dnsmasq_log.php"); exit; } function log_get_contents($logfile, $type) { $content = array(); $param = isset($config['syslogd']['reverse']) ? "-r " : ""; $param .= "-n 200"; switch ($type) {
<?php require_once '../../includes/initialize.php'; if (!$session->is_logged_in()) { redirect_to("login.php"); } if (isset($_GET['clear'])) { if ($_GET['clear'] == 'true') { log_clear(); log_action('Log', 'log was cleared.'); redirect_to('logfile.php'); } } ?> <?php include_layout_template('admin_header.php'); ?> <div id="menu"> <h2>Log file</h2> <a href="logfile.php?clear=true">Clear log file.</a> </div> <?php echo nl2br(log_read()); include_layout_template('admin_footer.php');
function form_post() { $get_string = ""; /* Process clear request and get out */ if (isset($_POST["box-1-action-clear-button"])) { header("logs.php"); } if (($_POST["action_post"] == "box-1") && (isset($_POST["box-1-action-area-type"]))) { if (($_POST["box-1-action-area-type"] == "search") || ($_POST["box-1-action-area-type"] == "export")) { if (trim($_POST["box-1-search_filter"]) != "") { $get_string = ($get_string == "" ? "?" : "&") . "search_filter=" . urlencode($_POST["box-1-search_filter"]); } if (isset($_POST["box-1-search_facility"])) { if ($_POST["box-1-search_facility"] != "-1") { $get_string .= ($get_string == "" ? "?" : "&") . "search_facility=" . urlencode($_POST["box-1-search_facility"]); } } if (isset($_POST["box-1-search_severity"])) { if ($_POST["box-1-search_severity"] != "-2") { $get_string .= ($get_string == "" ? "?" : "&") . "search_severity=" . urlencode($_POST["box-1-search_severity"]); } } if (isset($_POST["box-1-search_poller"])) { if ($_POST["box-1-search_poller"] != "-1") { $get_string .= ($get_string == "" ? "?" : "&") . "search_poller=" . urlencode($_POST["box-1-search_poller"]); } } if (isset($_POST["box-1-search_host"])) { if ($_POST["box-1-search_host"] != "-1") { $get_string .= ($get_string == "" ? "?" : "&") . "search_host=" . urlencode($_POST["box-1-search_host"]); } } if (isset($_POST["box-1-search_plugin"])) { if ($_POST["box-1-search_plugin"] != "-1") { $get_string .= ($get_string == "" ? "?" : "&") . "search_plugin=" . urlencode($_POST["box-1-search_plugin"]); } } if (isset($_POST["box-1-search_username"])) { if ($_POST["box-1-search_username"] != "-1") { $get_string .= ($get_string == "" ? "?" : "&") . "search_username="******"box-1-search_username"]); } } if (isset($_POST["box-1-search_source"])) { if ($_POST["box-1-search_source"] != "") { $get_string .= ($get_string == "" ? "?" : "&") . "search_source=" . urlencode($_POST["box-1-search_source"]); } } if (isset($_POST["box-1-search_start_date"])) { if ($_POST["box-1-search_start_date"] != "") { $get_string .= ($get_string == "" ? "?" : "&") . "search_start_date=" . urlencode($_POST["box-1-search_start_date"]); } } if (isset($_POST["box-1-search_end_date"])) { if ($_POST["box-1-search_end_date"] != "") { $get_string .= ($get_string == "" ? "?" : "&") . "search_end_date=" . urlencode($_POST["box-1-search_end_date"]); } } } } elseif ((isset($_POST["box-1-search_filter"]))) { if (!isset($_POST["box-1-action-clear-button"])) { if (trim($_POST["box-1-search_filter"]) != "") { $get_string = ($get_string == "" ? "?" : "&") . "search_filter=" . urlencode($_POST["box-1-search_filter"]); } } } if (isset($_POST["box-1-action-area-type"])) { if ($_POST["box-1-action-area-type"] == "export") { $get_string .= ($get_string == "" ? "?" : "&") . "action=export"; }elseif ($_POST["box-1-action-area-type"] == "purge") { log_clear(); $get_string=""; } } header("Location: logs.php" . $get_string); exit; }