1 |
cfc707f7
|
Scott Ullrich
|
<?php
|
2 |
5b237745
|
Scott Ullrich
|
/*
|
3 |
c5d81585
|
Renato Botelho
|
* status_logs.php
|
4 |
fd9ebcd5
|
Stephen Beaver
|
*
|
5 |
c5d81585
|
Renato Botelho
|
* part of pfSense (https://www.pfsense.org)
|
6 |
b8f91b7c
|
Luiz Souza
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
7 |
c5d81585
|
Renato Botelho
|
* All rights reserved.
|
8 |
fd9ebcd5
|
Stephen Beaver
|
*
|
9 |
c5d81585
|
Renato Botelho
|
* originally based on m0n0wall (http://m0n0.ch/wall)
|
10 |
|
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11 |
|
|
* All rights reserved.
|
12 |
fd9ebcd5
|
Stephen Beaver
|
*
|
13 |
b12ea3fb
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*
|
17 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
18 |
fd9ebcd5
|
Stephen Beaver
|
*
|
19 |
b12ea3fb
|
Renato Botelho
|
* 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 |
fd9ebcd5
|
Stephen Beaver
|
*/
|
25 |
5b237745
|
Scott Ullrich
|
|
26 |
6b07c15a
|
Matthew Grooms
|
##|+PRIV
|
27 |
|
|
##|*IDENT=page-diagnostics-logs-system
|
28 |
5230f468
|
jim-p
|
##|*NAME=Status: Logs: System
|
29 |
0b8328c5
|
jim-p
|
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
|
30 |
1af5edbf
|
Stephen Beaver
|
##|*MATCH=status_logs.php
|
31 |
6b07c15a
|
Matthew Grooms
|
##|-PRIV
|
32 |
|
|
|
33 |
55f8344d
|
NOYB
|
require_once("status_logs_common.inc");
|
34 |
|
|
|
35 |
5b237745
|
Scott Ullrich
|
|
36 |
d8af270c
|
jim-p
|
/*
|
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 |
3bd74348
|
bruno
|
"system" => array("name" => gettext("General"),
|
42 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
43 |
3bd74348
|
bruno
|
"dhcpd" => array("name" => gettext("DHCP"),
|
44 |
d8af270c
|
jim-p
|
"shortcut" => "dhcp"),
|
45 |
44c0a159
|
k-paulius
|
"portalauth" => array("name" => gettext("Captive Portal Auth"),
|
46 |
d8af270c
|
jim-p
|
"shortcut" => "captiveportal"),
|
47 |
3bd74348
|
bruno
|
"ipsec" => array("name" => gettext("IPsec"),
|
48 |
d8af270c
|
jim-p
|
"shortcut" => "ipsec"),
|
49 |
3bd74348
|
bruno
|
"ppp" => array("name" => gettext("PPP"),
|
50 |
d8af270c
|
jim-p
|
"shortcut" => ""),
|
51 |
3bd74348
|
bruno
|
"relayd" => array("name" => gettext("Load Balancer"),
|
52 |
d8af270c
|
jim-p
|
"shortcut" => "relayd"),
|
53 |
3bd74348
|
bruno
|
"openvpn" => array("name" => gettext("OpenVPN"),
|
54 |
d8af270c
|
jim-p
|
"shortcut" => "openvpn"),
|
55 |
44c0a159
|
k-paulius
|
"ntpd" => array("name" => gettext("NTP"),
|
56 |
d8af270c
|
jim-p
|
"shortcut" => "ntp"),
|
57 |
3bd74348
|
bruno
|
"gateways" => array("name" => gettext("Gateways"),
|
58 |
d8af270c
|
jim-p
|
"shortcut" => "gateways"),
|
59 |
3bd74348
|
bruno
|
"routing" => array("name" => gettext("Routing"),
|
60 |
d8af270c
|
jim-p
|
"shortcut" => "routing"),
|
61 |
3bd74348
|
bruno
|
"resolver" => array("name" => gettext("DNS Resolver"),
|
62 |
d8af270c
|
jim-p
|
"shortcut" => "resolver"),
|
63 |
3bd74348
|
bruno
|
"wireless" => array("name" => gettext("Wireless"),
|
64 |
d8af270c
|
jim-p
|
"shortcut" => "wireless"),
|
65 |
|
|
);
|
66 |
|
|
|
67 |
1a8b6554
|
Steve Beaver
|
// The logs to display are specified in a REQUEST argument. Default to 'system' logs
|
68 |
|
|
if (!$_REQUEST['logfile']) {
|
69 |
0a5d0b7b
|
sbeaver
|
$logfile = 'system';
|
70 |
d8af270c
|
jim-p
|
} else {
|
71 |
1a8b6554
|
Steve Beaver
|
$logfile = $_REQUEST['logfile'];
|
72 |
d8af270c
|
jim-p
|
if (!array_key_exists($logfile, $allowed_logs)) {
|
73 |
|
|
/* Do not let someone attempt to load an unauthorized log. */
|
74 |
|
|
$logfile = 'system';
|
75 |
|
|
}
|
76 |
|
|
}
|
77 |
0a5d0b7b
|
sbeaver
|
|
78 |
76af8cdb
|
NOYB
|
|
79 |
55f8344d
|
NOYB
|
// Log Filter Submit - System
|
80 |
|
|
log_filter_form_system_submit();
|
81 |
76af8cdb
|
NOYB
|
|
82 |
|
|
|
83 |
55f8344d
|
NOYB
|
// Manage Log Section - Code
|
84 |
|
|
manage_log_code();
|
85 |
5b237745
|
Scott Ullrich
|
|
86 |
|
|
|
87 |
0039dab0
|
NOYB
|
// Status Logs Common - Code
|
88 |
|
|
status_logs_common_code();
|
89 |
0541e302
|
Scott Ullrich
|
|
90 |
|
|
|
91 |
5f601060
|
Phil Davis
|
if ($filtertext) {
|
92 |
36a166de
|
Scott Ullrich
|
$filtertextmeta="?filtertext=$filtertext";
|
93 |
5f601060
|
Phil Davis
|
}
|
94 |
59769c23
|
Scott Ullrich
|
|
95 |
44c0a159
|
k-paulius
|
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 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "status_logs.php", "status_logs.php", "@self");
|
98 |
44c0a159
|
k-paulius
|
} else {
|
99 |
|
|
$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
|
100 |
edcd7535
|
Phil Davis
|
$pglinks = array("", "status_logs.php", "@self");
|
101 |
44c0a159
|
k-paulius
|
}
|
102 |
b63695db
|
Scott Ullrich
|
include("head.inc");
|
103 |
|
|
|
104 |
44c42356
|
Phil Davis
|
if ($changes_applied) {
|
105 |
|
|
print_apply_result_box($retval, $extra_save_msg);
|
106 |
76af8cdb
|
NOYB
|
$manage_log_active = false;
|
107 |
|
|
}
|
108 |
|
|
|
109 |
55f8344d
|
NOYB
|
// Tab Array
|
110 |
|
|
tab_array_logs_common();
|
111 |
33d52df1
|
sbeaver
|
|
112 |
|
|
|
113 |
c05363c8
|
NOYB
|
// Manage Log - Section/Form
|
114 |
|
|
if ($system_logs_manage_log_form_hidden) {
|
115 |
|
|
manage_log_section();
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
|
119 |
55f8344d
|
NOYB
|
// Filter Section/Form - System
|
120 |
|
|
filter_form_system();
|
121 |
e3efcb23
|
NOYB
|
|
122 |
5b237745
|
Scott Ullrich
|
|
123 |
e3efcb23
|
NOYB
|
// Now the forms are complete we can draw the log table and its controls
|
124 |
76af8cdb
|
NOYB
|
if (!$rawfilter) {
|
125 |
dc14d2b0
|
NOYB
|
system_log_filter();
|
126 |
e0977fed
|
smos
|
?>
|
127 |
9279147a
|
Stephen Beaver
|
|
128 |
e3efcb23
|
NOYB
|
<div class="panel panel-default">
|
129 |
|
|
<div class="panel-heading">
|
130 |
|
|
<h2 class="panel-title">
|
131 |
|
|
<?php
|
132 |
5330a238
|
NOYB
|
print(system_log_table_panel_title());
|
133 |
e3efcb23
|
NOYB
|
?>
|
134 |
|
|
</h2>
|
135 |
|
|
</div>
|
136 |
|
|
<div class="panel-body">
|
137 |
|
|
<div class="table-responsive">
|
138 |
b9db8882
|
NOYB
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
139 |
|
|
<thead>
|
140 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
141 |
b9db8882
|
NOYB
|
<th><?=gettext("Time")?></th>
|
142 |
|
|
<th><?=gettext("Process")?></th>
|
143 |
13474eee
|
NOYB
|
<th><?=gettext("PID")?></th>
|
144 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
145 |
b9db8882
|
NOYB
|
</tr>
|
146 |
|
|
</thead>
|
147 |
|
|
<tbody>
|
148 |
e3efcb23
|
NOYB
|
<?php
|
149 |
|
|
foreach ($filterlog as $filterent) {
|
150 |
|
|
?>
|
151 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
152 |
13474eee
|
NOYB
|
<td>
|
153 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['time'])?>
|
154 |
|
|
</td>
|
155 |
13474eee
|
NOYB
|
<td>
|
156 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['process'])?>
|
157 |
|
|
</td>
|
158 |
13474eee
|
NOYB
|
<td>
|
159 |
b9db8882
|
NOYB
|
<?=htmlspecialchars($filterent['pid'])?>
|
160 |
|
|
</td>
|
161 |
|
|
<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
|
162 |
|
|
<?=htmlspecialchars($filterent['message'])?>
|
163 |
|
|
</td>
|
164 |
|
|
</tr>
|
165 |
e3efcb23
|
NOYB
|
<?php
|
166 |
|
|
} // e-o-foreach
|
167 |
|
|
?>
|
168 |
be5bacfd
|
NOYB
|
</tbody>
|
169 |
e3efcb23
|
NOYB
|
</table>
|
170 |
76af8cdb
|
NOYB
|
<?php
|
171 |
abe98adb
|
Phil Davis
|
if (count($filterlog) == 0) {
|
172 |
8545adde
|
k-paulius
|
print_info_box(gettext('No logs to display.'));
|
173 |
abe98adb
|
Phil Davis
|
}
|
174 |
76af8cdb
|
NOYB
|
?>
|
175 |
e3efcb23
|
NOYB
|
</div>
|
176 |
|
|
</div>
|
177 |
|
|
</div>
|
178 |
|
|
<?php
|
179 |
abe98adb
|
Phil Davis
|
} else {
|
180 |
e3efcb23
|
NOYB
|
?>
|
181 |
5d7a0cca
|
sbeaver
|
<div class="panel panel-default">
|
182 |
98bf911e
|
NOYB
|
<div class="panel-heading">
|
183 |
|
|
<h2 class="panel-title">
|
184 |
|
|
<?php
|
185 |
5330a238
|
NOYB
|
print(system_log_table_panel_title());
|
186 |
98bf911e
|
NOYB
|
?>
|
187 |
|
|
</h2>
|
188 |
|
|
</div>
|
189 |
ba6c5357
|
Stephen Beaver
|
<div class="table table-responsive">
|
190 |
13474eee
|
NOYB
|
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
|
191 |
ba6c5357
|
Stephen Beaver
|
<thead>
|
192 |
b77cef66
|
Colin Fleming
|
<tr class="text-nowrap">
|
193 |
95acc890
|
NOYB
|
<th><?=gettext("Time")?></th>
|
194 |
|
|
<th style="width:100%"><?=gettext("Message")?></th>
|
195 |
ba6c5357
|
Stephen Beaver
|
</tr>
|
196 |
|
|
</thead>
|
197 |
|
|
<tbody>
|
198 |
|
|
<?php
|
199 |
abe98adb
|
Phil Davis
|
if (($logfile == 'resolver') || ($logfile == 'system')) {
|
200 |
5d7a0cca
|
sbeaver
|
$inverse = array("ppp");
|
201 |
abe98adb
|
Phil Davis
|
} else {
|
202 |
5d7a0cca
|
sbeaver
|
$inverse = null;
|
203 |
abe98adb
|
Phil Davis
|
}
|
204 |
5d7a0cca
|
sbeaver
|
|
205 |
dc14d2b0
|
NOYB
|
system_log_filter();
|
206 |
b63695db
|
Scott Ullrich
|
?>
|
207 |
ba6c5357
|
Stephen Beaver
|
</tbody>
|
208 |
|
|
</table>
|
209 |
7345fad6
|
NOYB
|
|
210 |
|
|
<script type="text/javascript">
|
211 |
|
|
//<![CDATA[
|
212 |
|
|
events.push(function() {
|
213 |
|
|
$("#count").html(<?=$rows?>);
|
214 |
|
|
});
|
215 |
|
|
//]]>
|
216 |
|
|
</script>
|
217 |
|
|
|
218 |
e3efcb23
|
NOYB
|
<?php
|
219 |
abe98adb
|
Phil Davis
|
if ($rows == 0) {
|
220 |
8545adde
|
k-paulius
|
print_info_box(gettext('No logs to display.'));
|
221 |
abe98adb
|
Phil Davis
|
}
|
222 |
76af8cdb
|
NOYB
|
?>
|
223 |
|
|
</div>
|
224 |
|
|
</div>
|
225 |
|
|
<?php
|
226 |
e3efcb23
|
NOYB
|
}
|
227 |
|
|
|
228 |
76af8cdb
|
NOYB
|
# Manage Log - Section/Form
|
229 |
c05363c8
|
NOYB
|
if (!$system_logs_manage_log_form_hidden) {
|
230 |
|
|
manage_log_section();
|
231 |
|
|
}
|
232 |
e3efcb23
|
NOYB
|
?>
|
233 |
33d52df1
|
sbeaver
|
|
234 |
c10cb196
|
Stephen Beaver
|
<?php include("foot.inc"); ?>
|