1 |
cfc707f7
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
1af5edbf
|
Stephen Beaver
|
status_logs.php
|
4 |
5b237745
|
Scott Ullrich
|
*/
|
5 |
fd9ebcd5
|
Stephen Beaver
|
/* ====================================================================
|
6 |
0da0d43e
|
Phil Davis
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7 |
9da2cf1c
|
Stephen Beaver
|
*
|
8 |
c9df279d
|
Stephen Beaver
|
* Some or all of this file is based on the m0n0wall project which is
|
9 |
9da2cf1c
|
Stephen Beaver
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10 |
fd9ebcd5
|
Stephen Beaver
|
*
|
11 |
0da0d43e
|
Phil Davis
|
* Redistribution and use in source and binary forms, with or without modification,
|
12 |
|
|
* are permitted provided that the following conditions are met:
|
13 |
fd9ebcd5
|
Stephen Beaver
|
*
|
14 |
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
* this list of conditions and the following disclaimer.
|
16 |
|
|
*
|
17 |
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
* notice, this list of conditions and the following disclaimer in
|
19 |
|
|
* the documentation and/or other materials provided with the
|
20 |
0da0d43e
|
Phil Davis
|
* distribution.
|
21 |
fd9ebcd5
|
Stephen Beaver
|
*
|
22 |
0da0d43e
|
Phil Davis
|
* 3. All advertising materials mentioning features or use of this software
|
23 |
fd9ebcd5
|
Stephen Beaver
|
* must display the following acknowledgment:
|
24 |
|
|
* "This product includes software developed by the pfSense Project
|
25 |
0da0d43e
|
Phil Davis
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26 |
fd9ebcd5
|
Stephen Beaver
|
*
|
27 |
|
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
28 |
|
|
* endorse or promote products derived from this software without
|
29 |
|
|
* prior written permission. For written permission, please contact
|
30 |
|
|
* coreteam@pfsense.org.
|
31 |
|
|
*
|
32 |
|
|
* 5. Products derived from this software may not be called "pfSense"
|
33 |
|
|
* nor may "pfSense" appear in their names without prior written
|
34 |
|
|
* permission of the Electric Sheep Fencing, LLC.
|
35 |
|
|
*
|
36 |
|
|
* 6. Redistributions of any form whatsoever must retain the following
|
37 |
|
|
* acknowledgment:
|
38 |
|
|
*
|
39 |
|
|
* "This product includes software developed by the pfSense Project
|
40 |
|
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
41 |
0da0d43e
|
Phil Davis
|
*
|
42 |
fd9ebcd5
|
Stephen Beaver
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
43 |
|
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
44 |
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
45 |
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
46 |
|
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
47 |
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
48 |
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
49 |
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
50 |
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
51 |
|
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
52 |
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
53 |
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
54 |
|
|
*
|
55 |
|
|
* ====================================================================
|
56 |
|
|
*
|
57 |
|
|
*/
|
58 |
5b237745
|
Scott Ullrich
|
|
59 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
60 |
|
|
##|*IDENT=page-diagnostics-logs-system
|
61 |
5230f468
|
jim-p
|
##|*NAME=Status: Logs: System
|
62 |
0b8328c5
|
jim-p
|
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
|
63 |
1af5edbf
|
Stephen Beaver
|
##|*MATCH=status_logs.php
|
64 |
6b07c15a
|
Matthew Grooms
|
##|-PRIV
|
65 |
|
|
|
66 |
55f8344d
|
NOYB
|
require_once("status_logs_common.inc");
|
67 |
|
|
|
68 |
5b237745
|
Scott Ullrich
|
|
69 |
d8af270c
|
jim-p
|
/*
|
70 |
|
|
Build a list of allowed log files so we can reject others to prevent the page
|
71 |
|
|
from acting on unauthorized files.
|
72 |
|
|
*/
|
73 |
|
|
$allowed_logs = array(
|
74 |
3bd74348
|
bruno
|
"system" => array("name" => gettext("General"),
|
75 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
76 |
3bd74348
|
bruno
|
"dhcpd" => array("name" => gettext("DHCP"),
|
77 |
d8af270c
|
jim-p
|
"shortcut" => "dhcp"),
|
78 |
44c0a159
|
k-paulius
|
"portalauth" => array("name" => gettext("Captive Portal Auth"),
|
79 |
d8af270c
|
jim-p
|
"shortcut" => "captiveportal"),
|
80 |
3bd74348
|
bruno
|
"ipsec" => array("name" => gettext("IPsec"),
|
81 |
d8af270c
|
jim-p
|
"shortcut" => "ipsec"),
|
82 |
3bd74348
|
bruno
|
"ppp" => array("name" => gettext("PPP"),
|
83 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
84 |
3bd74348
|
bruno
|
"relayd" => array("name" => gettext("Load Balancer"),
|
85 |
d8af270c
|
jim-p
|
"shortcut" => "relayd"),
|
86 |
3bd74348
|
bruno
|
"openvpn" => array("name" => gettext("OpenVPN"),
|
87 |
d8af270c
|
jim-p
|
"shortcut" => "openvpn"),
|
88 |
44c0a159
|
k-paulius
|
"ntpd" => array("name" => gettext("NTP"),
|
89 |
d8af270c
|
jim-p
|
"shortcut" => "ntp"),
|
90 |
3bd74348
|
bruno
|
"gateways" => array("name" => gettext("Gateways"),
|
91 |
d8af270c
|
jim-p
|
"shortcut" => "gateways"),
|
92 |
3bd74348
|
bruno
|
"routing" => array("name" => gettext("Routing"),
|
93 |
d8af270c
|
jim-p
|
"shortcut" => "routing"),
|
94 |
3bd74348
|
bruno
|
"resolver" => array("name" => gettext("DNS Resolver"),
|
95 |
d8af270c
|
jim-p
|
"shortcut" => "resolver"),
|
96 |
3bd74348
|
bruno
|
"wireless" => array("name" => gettext("Wireless"),
|
97 |
d8af270c
|
jim-p
|
"shortcut" => "wireless"),
|
98 |
|
|
);
|
99 |
|
|
|
100 |
0a5d0b7b
|
sbeaver
|
// The logs to display are specified in a GET argument. Default to 'system' logs
|
101 |
d8af270c
|
jim-p
|
if (!$_GET['logfile']) {
|
102 |
0a5d0b7b
|
sbeaver
|
$logfile = 'system';
|
103 |
d8af270c
|
jim-p
|
} else {
|
104 |
0a5d0b7b
|
sbeaver
|
$logfile = $_GET['logfile'];
|
105 |
d8af270c
|
jim-p
|
if (!array_key_exists($logfile, $allowed_logs)) {
|
106 |
|
|
/* Do not let someone attempt to load an unauthorized log. */
|
107 |
|
|
$logfile = 'system';
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
0a5d0b7b
|
sbeaver
|
|
111 |
76af8cdb
|
NOYB
|
|
112 |
55f8344d
|
NOYB
|
// Log Filter Submit - System
|
113 |
|
|
log_filter_form_system_submit();
|
114 |
76af8cdb
|
NOYB
|
|
115 |
|
|
|
116 |
55f8344d
|
NOYB
|
// Manage Log Section - Code
|
117 |
|
|
manage_log_code();
|
118 |
5b237745
|
Scott Ullrich
|
|
119 |
|
|
|
120 |
0039dab0
|
NOYB
|
// Status Logs Common - Code
|
121 |
|
|
status_logs_common_code();
|
122 |
0541e302
|
Scott Ullrich
|
|
123 |
|
|
|
124 |
5f601060
|
Phil Davis
|
if ($filtertext) {
|
125 |
36a166de
|
Scott Ullrich
|
$filtertextmeta="?filtertext=$filtertext";
|
126 |
5f601060
|
Phil Davis
|
}
|
127 |
59769c23
|
Scott Ullrich
|
|
128 |
44c0a159
|
k-paulius
|
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
|
129 |
|
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext("System"), $allowed_logs[$logfile]["name"]);
|
130 |
|
|
} else {
|
131 |
|
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
|
132 |
|
|
}
|
133 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
134 |
|
|
|
135 |
76af8cdb
|
NOYB
|
if (!$input_errors && $savemsg) {
|
136 |
f1ac5d23
|
NOYB
|
print_info_box($savemsg, 'success');
|
137 |
76af8cdb
|
NOYB
|
$manage_log_active = false;
|
138 |
|
|
}
|
139 |
|
|
|
140 |
55f8344d
|
NOYB
|
// Tab Array
|
141 |
|
|
tab_array_logs_common();
|
142 |
33d52df1
|
sbeaver
|
|
143 |
|
|
|
144 |
c05363c8
|
NOYB
|
// Manage Log - Section/Form
|
145 |
|
|
if ($system_logs_manage_log_form_hidden) {
|
146 |
|
|
manage_log_section();
|
147 |
|
|
}
|
148 |
|
|
|
149 |
|
|
|
150 |
55f8344d
|
NOYB
|
// Filter Section/Form - System
|
151 |
|
|
filter_form_system();
|
152 |
e3efcb23
|
NOYB
|
|
153 |
5b237745
|
Scott Ullrich
|
|
154 |
e3efcb23
|
NOYB
|
// Now the forms are complete we can draw the log table and its controls
|
155 |
76af8cdb
|
NOYB
|
if (!$rawfilter) {
|
156 |
dc14d2b0
|
NOYB
|
system_log_filter();
|
157 |
e0977fed
|
smos
|
?>
|
158 |
9279147a
|
Stephen Beaver
|
|
159 |
e3efcb23
|
NOYB
|
<div class="panel panel-default">
|
160 |
|
|
<div class="panel-heading">
|
161 |
|
|
<h2 class="panel-title">
|
162 |
|
|
<?php
|
163 |
5330a238
|
NOYB
|
print(system_log_table_panel_title());
|
164 |
e3efcb23
|
NOYB
|
?>
|
165 |
|
|
</h2>
|
166 |
|
|
</div>
|
167 |
|
|
<div class="panel-body">
|
168 |
|
|
<div class="table-responsive">
|
169 |
b9db8882
|
NOYB
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
170 |
|
|
<thead>
|
171 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
172 |
b9db8882
|
NOYB
|
<th><?=gettext("Time")?></th>
|
173 |
|
|
<th><?=gettext("Process")?></th>
|
174 |
13474eee
|
NOYB
|
<th><?=gettext("PID")?></th>
|
175 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
176 |
b9db8882
|
NOYB
|
</tr>
|
177 |
|
|
</thead>
|
178 |
|
|
<tbody>
|
179 |
e3efcb23
|
NOYB
|
<?php
|
180 |
|
|
foreach ($filterlog as $filterent) {
|
181 |
|
|
?>
|
182 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
183 |
13474eee
|
NOYB
|
<td>
|
184 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['time'])?>
|
185 |
|
|
</td>
|
186 |
13474eee
|
NOYB
|
<td>
|
187 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['process'])?>
|
188 |
|
|
</td>
|
189 |
13474eee
|
NOYB
|
<td>
|
190 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['pid'])?>
|
191 |
|
|
</td>
|
192 |
|
|
<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
|
193 |
|
|
<?=htmlspecialchars($filterent['message'])?>
|
194 |
|
|
</td>
|
195 |
|
|
</tr>
|
196 |
e3efcb23
|
NOYB
|
<?php
|
197 |
|
|
} // e-o-foreach
|
198 |
|
|
?>
|
199 |
be5bacfd
|
NOYB
|
</tbody>
|
200 |
e3efcb23
|
NOYB
|
</table>
|
201 |
76af8cdb
|
NOYB
|
<?php
|
202 |
abe98adb
|
Phil Davis
|
if (count($filterlog) == 0) {
|
203 |
8545adde
|
k-paulius
|
print_info_box(gettext('No logs to display.'));
|
204 |
abe98adb
|
Phil Davis
|
}
|
205 |
76af8cdb
|
NOYB
|
?>
|
206 |
e3efcb23
|
NOYB
|
</div>
|
207 |
|
|
</div>
|
208 |
|
|
</div>
|
209 |
|
|
<?php
|
210 |
abe98adb
|
Phil Davis
|
} else {
|
211 |
e3efcb23
|
NOYB
|
?>
|
212 |
5d7a0cca
|
sbeaver
|
<div class="panel panel-default">
|
213 |
98bf911e
|
NOYB
|
<div class="panel-heading">
|
214 |
|
|
<h2 class="panel-title">
|
215 |
|
|
<?php
|
216 |
5330a238
|
NOYB
|
print(system_log_table_panel_title());
|
217 |
98bf911e
|
NOYB
|
?>
|
218 |
|
|
</h2>
|
219 |
|
|
</div>
|
220 |
ba6c5357
|
Stephen Beaver
|
<div class="table table-responsive">
|
221 |
13474eee
|
NOYB
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
222 |
ba6c5357
|
Stephen Beaver
|
<thead>
|
223 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
224 |
95acc890
|
NOYB
|
<th><?=gettext("Time")?></th>
|
225 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
226 |
ba6c5357
|
Stephen Beaver
|
</tr>
|
227 |
|
|
</thead>
|
228 |
|
|
<tbody>
|
229 |
|
|
<?php
|
230 |
abe98adb
|
Phil Davis
|
if (($logfile == 'resolver') || ($logfile == 'system')) {
|
231 |
5d7a0cca
|
sbeaver
|
$inverse = array("ppp");
|
232 |
abe98adb
|
Phil Davis
|
} else {
|
233 |
5d7a0cca
|
sbeaver
|
$inverse = null;
|
234 |
abe98adb
|
Phil Davis
|
}
|
235 |
5d7a0cca
|
sbeaver
|
|
236 |
dc14d2b0
|
NOYB
|
system_log_filter();
|
237 |
b63695db
|
Scott Ullrich
|
?>
|
238 |
ba6c5357
|
Stephen Beaver
|
</tbody>
|
239 |
|
|
</table>
|
240 |
7345fad6
|
NOYB
|
|
241 |
|
|
<script type="text/javascript">
|
242 |
|
|
//<![CDATA[
|
243 |
|
|
events.push(function() {
|
244 |
|
|
$("#count").html(<?=$rows?>);
|
245 |
|
|
});
|
246 |
|
|
//]]>
|
247 |
|
|
</script>
|
248 |
|
|
|
249 |
e3efcb23
|
NOYB
|
<?php
|
250 |
abe98adb
|
Phil Davis
|
if ($rows == 0) {
|
251 |
8545adde
|
k-paulius
|
print_info_box(gettext('No logs to display.'));
|
252 |
abe98adb
|
Phil Davis
|
}
|
253 |
76af8cdb
|
NOYB
|
?>
|
254 |
|
|
</div>
|
255 |
|
|
</div>
|
256 |
|
|
<?php
|
257 |
e3efcb23
|
NOYB
|
}
|
258 |
|
|
|
259 |
76af8cdb
|
NOYB
|
# Manage Log - Section/Form
|
260 |
c05363c8
|
NOYB
|
if (!$system_logs_manage_log_form_hidden) {
|
261 |
|
|
manage_log_section();
|
262 |
|
|
}
|
263 |
e3efcb23
|
NOYB
|
?>
|
264 |
33d52df1
|
sbeaver
|
|
265 |
c10cb196
|
Stephen Beaver
|
<?php include("foot.inc"); ?>
|