1
|
<?php
|
2
|
/*
|
3
|
status_logs.php
|
4
|
*/
|
5
|
/* ====================================================================
|
6
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
7
|
*
|
8
|
* Some or all of this file is based on the m0n0wall project which is
|
9
|
* Copyright (c) 2004 Manuel Kasper (BSD 2 clause)
|
10
|
*
|
11
|
* Redistribution and use in source and binary forms, with or without modification,
|
12
|
* are permitted provided that the following conditions are met:
|
13
|
*
|
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
|
* distribution.
|
21
|
*
|
22
|
* 3. All advertising materials mentioning features or use of this software
|
23
|
* must display the following acknowledgment:
|
24
|
* "This product includes software developed by the pfSense Project
|
25
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
26
|
*
|
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
|
*
|
42
|
* 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
|
|
59
|
##|+PRIV
|
60
|
##|*IDENT=page-diagnostics-logs-system
|
61
|
##|*NAME=Status: Logs: System
|
62
|
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
|
63
|
##|*MATCH=status_logs.php
|
64
|
##|-PRIV
|
65
|
|
66
|
require_once("status_logs_common.inc");
|
67
|
|
68
|
|
69
|
/*
|
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
|
"system" => array("name" => gettext("General"),
|
75
|
"shortcut" => ""),
|
76
|
"dhcpd" => array("name" => gettext("DHCP"),
|
77
|
"shortcut" => "dhcp"),
|
78
|
"portalauth" => array("name" => gettext("Captive Portal Auth"),
|
79
|
"shortcut" => "captiveportal"),
|
80
|
"ipsec" => array("name" => gettext("IPsec"),
|
81
|
"shortcut" => "ipsec"),
|
82
|
"ppp" => array("name" => gettext("PPP"),
|
83
|
"shortcut" => ""),
|
84
|
"relayd" => array("name" => gettext("Load Balancer"),
|
85
|
"shortcut" => "relayd"),
|
86
|
"openvpn" => array("name" => gettext("OpenVPN"),
|
87
|
"shortcut" => "openvpn"),
|
88
|
"ntpd" => array("name" => gettext("NTP"),
|
89
|
"shortcut" => "ntp"),
|
90
|
"gateways" => array("name" => gettext("Gateways"),
|
91
|
"shortcut" => "gateways"),
|
92
|
"routing" => array("name" => gettext("Routing"),
|
93
|
"shortcut" => "routing"),
|
94
|
"resolver" => array("name" => gettext("DNS Resolver"),
|
95
|
"shortcut" => "resolver"),
|
96
|
"wireless" => array("name" => gettext("Wireless"),
|
97
|
"shortcut" => "wireless"),
|
98
|
);
|
99
|
|
100
|
// The logs to display are specified in a GET argument. Default to 'system' logs
|
101
|
if (!$_GET['logfile']) {
|
102
|
$logfile = 'system';
|
103
|
} else {
|
104
|
$logfile = $_GET['logfile'];
|
105
|
if (!array_key_exists($logfile, $allowed_logs)) {
|
106
|
/* Do not let someone attempt to load an unauthorized log. */
|
107
|
$logfile = 'system';
|
108
|
}
|
109
|
}
|
110
|
|
111
|
|
112
|
// Log Filter Submit - System
|
113
|
log_filter_form_system_submit();
|
114
|
|
115
|
|
116
|
// Manage Log Section - Code
|
117
|
manage_log_code();
|
118
|
|
119
|
|
120
|
// Status Logs Common - Code
|
121
|
status_logs_common_code();
|
122
|
|
123
|
|
124
|
if ($filtertext) {
|
125
|
$filtertextmeta="?filtertext=$filtertext";
|
126
|
}
|
127
|
|
128
|
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
|
include("head.inc");
|
134
|
|
135
|
if (!$input_errors && $savemsg) {
|
136
|
print_info_box($savemsg, 'success');
|
137
|
$manage_log_active = false;
|
138
|
}
|
139
|
|
140
|
// Tab Array
|
141
|
tab_array_logs_common();
|
142
|
|
143
|
|
144
|
// Manage Log - Section/Form
|
145
|
if ($system_logs_manage_log_form_hidden) {
|
146
|
manage_log_section();
|
147
|
}
|
148
|
|
149
|
|
150
|
// Filter Section/Form - System
|
151
|
filter_form_system();
|
152
|
|
153
|
|
154
|
// Now the forms are complete we can draw the log table and its controls
|
155
|
if (!$rawfilter) {
|
156
|
system_log_filter();
|
157
|
?>
|
158
|
|
159
|
<div class="panel panel-default">
|
160
|
<div class="panel-heading">
|
161
|
<h2 class="panel-title">
|
162
|
<?php
|
163
|
print(system_log_table_panel_title());
|
164
|
?>
|
165
|
</h2>
|
166
|
</div>
|
167
|
<div class="panel-body">
|
168
|
<div class="table-responsive">
|
169
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
170
|
<thead>
|
171
|
<tr class="text-nowrap">
|
172
|
<th><?=gettext("Time")?></th>
|
173
|
<th><?=gettext("Process")?></th>
|
174
|
<th><?=gettext("PID")?></th>
|
175
|
<th style="width:100%"><?=gettext("Message")?></th>
|
176
|
</tr>
|
177
|
</thead>
|
178
|
<tbody>
|
179
|
<?php
|
180
|
foreach ($filterlog as $filterent) {
|
181
|
?>
|
182
|
<tr class="text-nowrap">
|
183
|
<td>
|
184
|
<?=htmlspecialchars($filterent['time'])?>
|
185
|
</td>
|
186
|
<td>
|
187
|
<?=htmlspecialchars($filterent['process'])?>
|
188
|
</td>
|
189
|
<td>
|
190
|
<?=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
|
<?php
|
197
|
} // e-o-foreach
|
198
|
?>
|
199
|
</tbody>
|
200
|
</table>
|
201
|
<?php
|
202
|
if (count($filterlog) == 0) {
|
203
|
print_info_box(gettext('No logs to display.'));
|
204
|
}
|
205
|
?>
|
206
|
</div>
|
207
|
</div>
|
208
|
</div>
|
209
|
<?php
|
210
|
} else {
|
211
|
?>
|
212
|
<div class="panel panel-default">
|
213
|
<div class="panel-heading">
|
214
|
<h2 class="panel-title">
|
215
|
<?php
|
216
|
print(system_log_table_panel_title());
|
217
|
?>
|
218
|
</h2>
|
219
|
</div>
|
220
|
<div class="table table-responsive">
|
221
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
222
|
<thead>
|
223
|
<tr class="text-nowrap">
|
224
|
<th><?=gettext("Time")?></th>
|
225
|
<th style="width:100%"><?=gettext("Message")?></th>
|
226
|
</tr>
|
227
|
</thead>
|
228
|
<tbody>
|
229
|
<?php
|
230
|
if (($logfile == 'resolver') || ($logfile == 'system')) {
|
231
|
$inverse = array("ppp");
|
232
|
} else {
|
233
|
$inverse = null;
|
234
|
}
|
235
|
|
236
|
system_log_filter();
|
237
|
?>
|
238
|
</tbody>
|
239
|
</table>
|
240
|
|
241
|
<script type="text/javascript">
|
242
|
//<![CDATA[
|
243
|
events.push(function() {
|
244
|
$("#count").html(<?=$rows?>);
|
245
|
});
|
246
|
//]]>
|
247
|
</script>
|
248
|
|
249
|
<?php
|
250
|
if ($rows == 0) {
|
251
|
print_info_box(gettext('No logs to display.'));
|
252
|
}
|
253
|
?>
|
254
|
</div>
|
255
|
</div>
|
256
|
<?php
|
257
|
}
|
258
|
|
259
|
# Manage Log - Section/Form
|
260
|
if (!$system_logs_manage_log_form_hidden) {
|
261
|
manage_log_section();
|
262
|
}
|
263
|
?>
|
264
|
|
265
|
<?php include("foot.inc"); ?>
|