| 1 |
df01982a
|
Colin Smith
|
<?php
|
| 2 |
|
|
/*
|
| 3 |
2eb4178b
|
Colin Smith
|
$Id$
|
| 4 |
|
|
|
| 5 |
df01982a
|
Colin Smith
|
diag_pkglogs.php
|
| 6 |
|
|
Copyright (C) 2005 Colin Smith
|
| 7 |
|
|
All rights reserved.
|
| 8 |
|
|
|
| 9 |
|
|
Redistribution and use in source and binary forms, with or without
|
| 10 |
|
|
modification, are permitted provided that the following conditions are met:
|
| 11 |
|
|
|
| 12 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
| 13 |
|
|
this list of conditions and the following disclaimer.
|
| 14 |
|
|
|
| 15 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
| 16 |
|
|
notice, this list of conditions and the following disclaimer in the
|
| 17 |
|
|
documentation and/or other materials provided with the distribution.
|
| 18 |
|
|
|
| 19 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
| 20 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
| 21 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
| 22 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
| 23 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
| 24 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
| 25 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
| 26 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
| 27 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
| 28 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
| 29 |
825275fa
|
Colin Smith
|
|
| 30 |
|
|
<logging>
|
| 31 |
|
|
<logtab>arpwatch</logtab>
|
| 32 |
|
|
<grepfor>arpwatch</logtab>
|
| 33 |
|
|
</logging>
|
| 34 |
|
|
|
| 35 |
|
|
<invertgrep/>
|
| 36 |
|
|
<logfile>/var/log/arpwatch.log</logfile>
|
| 37 |
|
|
|
| 38 |
df01982a
|
Colin Smith
|
*/
|
| 39 |
|
|
|
| 40 |
13d193c2
|
Scott Ullrich
|
/*
|
| 41 |
|
|
pfSense_BUILDER_BINARIES: /usr/bin/netstat
|
| 42 |
|
|
pfSense_MODULE: pkgs
|
| 43 |
|
|
*/
|
| 44 |
|
|
|
| 45 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
| 46 |
|
|
##|*IDENT=page-status-packagelogs
|
| 47 |
|
|
##|*NAME=Status: Package logs page
|
| 48 |
|
|
##|*DESCR=Allow access to the 'Status: Package logs' page.
|
| 49 |
|
|
##|*MATCH=diag_pkglogs.php*
|
| 50 |
|
|
##|-PRIV
|
| 51 |
|
|
|
| 52 |
df01982a
|
Colin Smith
|
require("guiconfig.inc");
|
| 53 |
|
|
|
| 54 |
af811174
|
Colin Smith
|
if(!($nentries = $config['syslog']['nentries'])) $nentries = 50;
|
| 55 |
df01982a
|
Colin Smith
|
|
| 56 |
d6abaa18
|
Scott Ullrich
|
//if ($_POST['clear'])
|
| 57 |
|
|
// clear_log_file($logfile);
|
| 58 |
|
|
|
| 59 |
2eb4178b
|
Colin Smith
|
$i = 0;
|
| 60 |
9fc0d646
|
Colin Smith
|
$pkgwithlogging = false;
|
| 61 |
2eb4178b
|
Colin Smith
|
$apkg = $_POST['pkg'];
|
| 62 |
af811174
|
Colin Smith
|
if(!$apkg) { // If we aren't looking for a specific package, locate the first package that handles logging.
|
| 63 |
52da2110
|
Colin Smith
|
if($config['installedpackages']['package'] <> "") {
|
| 64 |
c2eb36d9
|
Scott Ullrich
|
foreach($config['installedpackages']['package'] as $package) {
|
| 65 |
0187cf2a
|
Colin Smith
|
if(is_array($package['logging'])) {
|
| 66 |
9fc0d646
|
Colin Smith
|
$pkgwithlogging = true;
|
| 67 |
c2eb36d9
|
Scott Ullrich
|
$apkg = $package['name'];
|
| 68 |
|
|
$apkgid = $i;
|
| 69 |
|
|
break;
|
| 70 |
|
|
}
|
| 71 |
|
|
$i++;
|
| 72 |
2eb4178b
|
Colin Smith
|
}
|
| 73 |
42e72ab3
|
Scott Ullrich
|
}
|
| 74 |
af811174
|
Colin Smith
|
} elseif($apkg) {
|
| 75 |
9fc0d646
|
Colin Smith
|
$pkgwithlogging = true;
|
| 76 |
2eb4178b
|
Colin Smith
|
$apkgid = get_pkg_id($apkg);
|
| 77 |
52da2110
|
Colin Smith
|
$i = $apkgid;
|
| 78 |
2eb4178b
|
Colin Smith
|
}
|
| 79 |
df01982a
|
Colin Smith
|
|
| 80 |
0da88d50
|
cadu
|
$pgtitle = array(gettext("Status"),gettext("Package logs"));
|
| 81 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
| 82 |
|
|
|
| 83 |
|
|
?>
|
| 84 |
df01982a
|
Colin Smith
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
| 85 |
|
|
<?php include("fbegin.inc"); ?>
|
| 86 |
|
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
| 87 |
|
|
<tr><td>
|
| 88 |
|
|
<ul id="tabnav">
|
| 89 |
|
|
<?php
|
| 90 |
af811174
|
Colin Smith
|
if($pkgwithlogging == false) {
|
| 91 |
0da88d50
|
cadu
|
print_info_box(gettext("No packages with logging facilities are currently installed."));
|
| 92 |
af811174
|
Colin Smith
|
echo '</ul></td></tr></table>';
|
| 93 |
42e72ab3
|
Scott Ullrich
|
include("fend.inc");
|
| 94 |
52da2110
|
Colin Smith
|
exit;
|
| 95 |
42e72ab3
|
Scott Ullrich
|
}
|
| 96 |
af811174
|
Colin Smith
|
foreach($config['installedpackages']['package'] as $package) {
|
| 97 |
|
|
if(is_array($package['logging'])) {
|
| 98 |
|
|
if(!($logtab = $package['logging']['logtab'])) $logtab = $package['name'];
|
| 99 |
|
|
if($apkg == $package['name']) {
|
| 100 |
|
|
$curtab = $logtab;
|
| 101 |
|
|
echo '<li class="tabact">' . $logtab . '</li>';
|
| 102 |
|
|
} else {
|
| 103 |
|
|
Echo '<li class="tabinact"><a href="diag_pkglogs.php?pkg=' . htmlspecialchars($package['name']) . '">' . $logtab . '</a></li>';
|
| 104 |
df01982a
|
Colin Smith
|
}
|
| 105 |
af811174
|
Colin Smith
|
}
|
| 106 |
|
|
}
|
| 107 |
df01982a
|
Colin Smith
|
?>
|
| 108 |
|
|
</ul>
|
| 109 |
|
|
</td></tr>
|
| 110 |
|
|
<tr>
|
| 111 |
|
|
<td class="tabcont">
|
| 112 |
|
|
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 113 |
|
|
<tr>
|
| 114 |
|
|
<td colspan="2" class="listtopic">
|
| 115 |
ddc55e12
|
Erik Fonnesbeck
|
<?php printf(gettext('Last %1$s %2$s log entries'),$nentries,$curtab); ?></td>
|
| 116 |
df01982a
|
Colin Smith
|
</tr>
|
| 117 |
|
|
<?php
|
| 118 |
af811174
|
Colin Smith
|
$package =& $config['installedpackages']['package'][$apkgid];
|
| 119 |
|
|
dump_clog($g['varlog_path'] . '/' . $package['logging']['logfilename'], $nentries);
|
| 120 |
df01982a
|
Colin Smith
|
?>
|
| 121 |
|
|
</table>
|
| 122 |
52da2110
|
Colin Smith
|
<br>
|
| 123 |
|
|
<!--
|
| 124 |
|
|
<form action="diag_pkglogs.php" method="post">
|
| 125 |
df01982a
|
Colin Smith
|
<input name="clear" type="submit" class="formbtn" value="Clear log">
|
| 126 |
|
|
</form>
|
| 127 |
52da2110
|
Colin Smith
|
-->
|
| 128 |
df01982a
|
Colin Smith
|
</td>
|
| 129 |
|
|
</tr>
|
| 130 |
|
|
</table>
|
| 131 |
|
|
<?php include("fend.inc"); ?>
|
| 132 |
|
|
</body>
|
| 133 |
|
|
</html>
|