1
|
<?php
|
2
|
/*
|
3
|
* status_logs.php
|
4
|
*
|
5
|
* part of pfSense (https://www.pfsense.org)
|
6
|
* Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
|
7
|
* All rights reserved.
|
8
|
*
|
9
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
* All rights reserved.
|
12
|
*
|
13
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
14
|
* you may not use this file except in compliance with the License.
|
15
|
* You may obtain a copy of the License at
|
16
|
*
|
17
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18
|
*
|
19
|
* Unless required by applicable law or agreed to in writing, software
|
20
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
21
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
22
|
* See the License for the specific language governing permissions and
|
23
|
* limitations under the License.
|
24
|
*/
|
25
|
|
26
|
##|+PRIV
|
27
|
##|*IDENT=page-diagnostics-logs-system
|
28
|
##|*NAME=Status: Logs: System
|
29
|
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
|
30
|
##|*MATCH=status_logs.php
|
31
|
##|-PRIV
|
32
|
|
33
|
require_once("status_logs_common.inc");
|
34
|
|
35
|
|
36
|
/*
|
37
|
Build a list of allowed log files so we can reject others to prevent the page
|
38
|
from acting on unauthorized files.
|
39
|
*/
|
40
|
$allowed_logs = array(
|
41
|
"system" => array("name" => gettext("General"),
|
42
|
"shortcut" => ""),
|
43
|
"dhcpd" => array("name" => gettext("DHCP"),
|
44
|
"shortcut" => "dhcp"),
|
45
|
"portalauth" => array("name" => gettext("Captive Portal Auth"),
|
46
|
"shortcut" => "captiveportal"),
|
47
|
"ipsec" => array("name" => gettext("IPsec"),
|
48
|
"shortcut" => "ipsec"),
|
49
|
"ppp" => array("name" => gettext("PPP"),
|
50
|
"shortcut" => ""),
|
51
|
"relayd" => array("name" => gettext("Load Balancer"),
|
52
|
"shortcut" => "relayd"),
|
53
|
"openvpn" => array("name" => gettext("OpenVPN"),
|
54
|
"shortcut" => "openvpn"),
|
55
|
"ntpd" => array("name" => gettext("NTP"),
|
56
|
"shortcut" => "ntp"),
|
57
|
"gateways" => array("name" => gettext("Gateways"),
|
58
|
"shortcut" => "gateways"),
|
59
|
"routing" => array("name" => gettext("Routing"),
|
60
|
"shortcut" => "routing"),
|
61
|
"resolver" => array("name" => gettext("DNS Resolver"),
|
62
|
"shortcut" => "resolver"),
|
63
|
"wireless" => array("name" => gettext("Wireless"),
|
64
|
"shortcut" => "wireless"),
|
65
|
);
|
66
|
|
67
|
// The logs to display are specified in a GET argument. Default to 'system' logs
|
68
|
if (!$_GET['logfile']) {
|
69
|
$logfile = 'system';
|
70
|
} else {
|
71
|
$logfile = $_GET['logfile'];
|
72
|
if (!array_key_exists($logfile, $allowed_logs)) {
|
73
|
/* Do not let someone attempt to load an unauthorized log. */
|
74
|
$logfile = 'system';
|
75
|
}
|
76
|
}
|
77
|
|
78
|
|
79
|
// Log Filter Submit - System
|
80
|
log_filter_form_system_submit();
|
81
|
|
82
|
|
83
|
// Manage Log Section - Code
|
84
|
manage_log_code();
|
85
|
|
86
|
|
87
|
// Status Logs Common - Code
|
88
|
status_logs_common_code();
|
89
|
|
90
|
|
91
|
if ($filtertext) {
|
92
|
$filtertextmeta="?filtertext=$filtertext";
|
93
|
}
|
94
|
|
95
|
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
|
96
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext("System"), $allowed_logs[$logfile]["name"]);
|
97
|
} else {
|
98
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
|
99
|
}
|
100
|
include("head.inc");
|
101
|
|
102
|
if (!$input_errors && $savemsg) {
|
103
|
print_info_box($savemsg, 'success');
|
104
|
$manage_log_active = false;
|
105
|
}
|
106
|
|
107
|
// Tab Array
|
108
|
tab_array_logs_common();
|
109
|
|
110
|
|
111
|
// Manage Log - Section/Form
|
112
|
if ($system_logs_manage_log_form_hidden) {
|
113
|
manage_log_section();
|
114
|
}
|
115
|
|
116
|
|
117
|
// Filter Section/Form - System
|
118
|
filter_form_system();
|
119
|
|
120
|
|
121
|
// Now the forms are complete we can draw the log table and its controls
|
122
|
if (!$rawfilter) {
|
123
|
system_log_filter();
|
124
|
?>
|
125
|
|
126
|
<div class="panel panel-default">
|
127
|
<div class="panel-heading">
|
128
|
<h2 class="panel-title">
|
129
|
<?php
|
130
|
print(system_log_table_panel_title());
|
131
|
?>
|
132
|
</h2>
|
133
|
</div>
|
134
|
<div class="panel-body">
|
135
|
<div class="table-responsive">
|
136
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
137
|
<thead>
|
138
|
<tr class="text-nowrap">
|
139
|
<th><?=gettext("Time")?></th>
|
140
|
<th><?=gettext("Process")?></th>
|
141
|
<th><?=gettext("PID")?></th>
|
142
|
<th style="width:100%"><?=gettext("Message")?></th>
|
143
|
</tr>
|
144
|
</thead>
|
145
|
<tbody>
|
146
|
<?php
|
147
|
foreach ($filterlog as $filterent) {
|
148
|
?>
|
149
|
<tr class="text-nowrap">
|
150
|
<td>
|
151
|
<?=htmlspecialchars($filterent['time'])?>
|
152
|
</td>
|
153
|
<td>
|
154
|
<?=htmlspecialchars($filterent['process'])?>
|
155
|
</td>
|
156
|
<td>
|
157
|
<?=htmlspecialchars($filterent['pid'])?>
|
158
|
</td>
|
159
|
<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
|
160
|
<?=htmlspecialchars($filterent['message'])?>
|
161
|
</td>
|
162
|
</tr>
|
163
|
<?php
|
164
|
} // e-o-foreach
|
165
|
?>
|
166
|
</tbody>
|
167
|
</table>
|
168
|
<?php
|
169
|
if (count($filterlog) == 0) {
|
170
|
print_info_box(gettext('No logs to display.'));
|
171
|
}
|
172
|
?>
|
173
|
</div>
|
174
|
</div>
|
175
|
</div>
|
176
|
<?php
|
177
|
} else {
|
178
|
?>
|
179
|
<div class="panel panel-default">
|
180
|
<div class="panel-heading">
|
181
|
<h2 class="panel-title">
|
182
|
<?php
|
183
|
print(system_log_table_panel_title());
|
184
|
?>
|
185
|
</h2>
|
186
|
</div>
|
187
|
<div class="table table-responsive">
|
188
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
189
|
<thead>
|
190
|
<tr class="text-nowrap">
|
191
|
<th><?=gettext("Time")?></th>
|
192
|
<th style="width:100%"><?=gettext("Message")?></th>
|
193
|
</tr>
|
194
|
</thead>
|
195
|
<tbody>
|
196
|
<?php
|
197
|
if (($logfile == 'resolver') || ($logfile == 'system')) {
|
198
|
$inverse = array("ppp");
|
199
|
} else {
|
200
|
$inverse = null;
|
201
|
}
|
202
|
|
203
|
system_log_filter();
|
204
|
?>
|
205
|
</tbody>
|
206
|
</table>
|
207
|
|
208
|
<script type="text/javascript">
|
209
|
//<![CDATA[
|
210
|
events.push(function() {
|
211
|
$("#count").html(<?=$rows?>);
|
212
|
});
|
213
|
//]]>
|
214
|
</script>
|
215
|
|
216
|
<?php
|
217
|
if ($rows == 0) {
|
218
|
print_info_box(gettext('No logs to display.'));
|
219
|
}
|
220
|
?>
|
221
|
</div>
|
222
|
</div>
|
223
|
<?php
|
224
|
}
|
225
|
|
226
|
# Manage Log - Section/Form
|
227
|
if (!$system_logs_manage_log_form_hidden) {
|
228
|
manage_log_section();
|
229
|
}
|
230
|
?>
|
231
|
|
232
|
<?php include("foot.inc"); ?>
|