Project

General

Profile

Download (5.55 KB) Statistics
| Branch: | Tag: | Revision:
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 81299b5c Renato Botelho
 * Copyright (c) 2004-2016 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 0a5d0b7b sbeaver
// The logs to display are specified in a GET argument. Default to 'system' logs
68 d8af270c jim-p
if (!$_GET['logfile']) {
69 0a5d0b7b sbeaver
	$logfile = 'system';
70 d8af270c jim-p
} else {
71 0a5d0b7b sbeaver
	$logfile = $_GET['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
} else {
98
	$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
99
}
100 b63695db Scott Ullrich
include("head.inc");
101
102 76af8cdb NOYB
if (!$input_errors && $savemsg) {
103 f1ac5d23 NOYB
	print_info_box($savemsg, 'success');
104 76af8cdb NOYB
	$manage_log_active = false;
105
}
106
107 55f8344d NOYB
// Tab Array
108
tab_array_logs_common();
109 33d52df1 sbeaver
110
111 c05363c8 NOYB
// Manage Log - Section/Form
112
if ($system_logs_manage_log_form_hidden) {
113
	manage_log_section();
114
}
115
116
117 55f8344d NOYB
// Filter Section/Form - System
118
filter_form_system();
119 e3efcb23 NOYB
120 5b237745 Scott Ullrich
121 e3efcb23 NOYB
// Now the forms are complete we can draw the log table and its controls
122 76af8cdb NOYB
if (!$rawfilter) {
123 dc14d2b0 NOYB
	system_log_filter();
124 e0977fed smos
?>
125 9279147a Stephen Beaver
126 e3efcb23 NOYB
<div class="panel panel-default">
127
	<div class="panel-heading">
128
		<h2 class="panel-title">
129
<?php
130 5330a238 NOYB
	print(system_log_table_panel_title());
131 e3efcb23 NOYB
?>
132
		</h2>
133
	</div>
134
	<div class="panel-body">
135
	   <div class="table-responsive">
136 b9db8882 NOYB
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
137
			<thead>
138 b77cef66 Colin Fleming
				<tr class="text-nowrap">
139 b9db8882 NOYB
					<th><?=gettext("Time")?></th>
140
					<th><?=gettext("Process")?></th>
141 13474eee NOYB
					<th><?=gettext("PID")?></th>
142
					<th style="width:100%"><?=gettext("Message")?></th>
143 b9db8882 NOYB
				</tr>
144
			</thead>
145
			<tbody>
146 e3efcb23 NOYB
<?php
147
	foreach ($filterlog as $filterent) {
148
?>
149 b77cef66 Colin Fleming
				<tr class="text-nowrap">
150 13474eee NOYB
					<td>
151 b9db8882 NOYB
						<?=htmlspecialchars($filterent['time'])?>
152
					</td>
153 13474eee NOYB
					<td>
154 b9db8882 NOYB
						<?=htmlspecialchars($filterent['process'])?>
155
					</td>
156 13474eee NOYB
					<td>
157 b9db8882 NOYB
						<?=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 e3efcb23 NOYB
<?php
164
	} // e-o-foreach
165
?>
166 be5bacfd NOYB
			</tbody>
167 e3efcb23 NOYB
		</table>
168 76af8cdb NOYB
<?php
169 abe98adb Phil Davis
	if (count($filterlog) == 0) {
170 8545adde k-paulius
		print_info_box(gettext('No logs to display.'));
171 abe98adb Phil Davis
	}
172 76af8cdb NOYB
?>
173 e3efcb23 NOYB
		</div>
174
	</div>
175
</div>
176
<?php
177 abe98adb Phil Davis
} else {
178 e3efcb23 NOYB
?>
179 5d7a0cca sbeaver
<div class="panel panel-default">
180 98bf911e NOYB
	<div class="panel-heading">
181
		<h2 class="panel-title">
182
<?php
183 5330a238 NOYB
	print(system_log_table_panel_title());
184 98bf911e NOYB
?>
185
		</h2>
186
	</div>
187 ba6c5357 Stephen Beaver
	<div class="table table-responsive">
188 13474eee NOYB
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
189 ba6c5357 Stephen Beaver
			<thead>
190 b77cef66 Colin Fleming
				<tr class="text-nowrap">
191 95acc890 NOYB
					<th><?=gettext("Time")?></th>
192
					<th style="width:100%"><?=gettext("Message")?></th>
193 ba6c5357 Stephen Beaver
				</tr>
194
			</thead>
195
			<tbody>
196
<?php
197 abe98adb Phil Davis
	if (($logfile == 'resolver') || ($logfile == 'system')) {
198 5d7a0cca sbeaver
		$inverse = array("ppp");
199 abe98adb Phil Davis
	} else {
200 5d7a0cca sbeaver
		$inverse = null;
201 abe98adb Phil Davis
	}
202 5d7a0cca sbeaver
203 dc14d2b0 NOYB
	system_log_filter();
204 b63695db Scott Ullrich
?>
205 ba6c5357 Stephen Beaver
			</tbody>
206
		</table>
207 7345fad6 NOYB
208
<script type="text/javascript">
209
//<![CDATA[
210
events.push(function() {
211
	$("#count").html(<?=$rows?>);
212
});
213
//]]>
214
</script>
215
216 e3efcb23 NOYB
<?php
217 abe98adb Phil Davis
	if ($rows == 0) {
218 8545adde k-paulius
		print_info_box(gettext('No logs to display.'));
219 abe98adb Phil Davis
	}
220 76af8cdb NOYB
?>
221
	</div>
222
</div>
223
<?php
224 e3efcb23 NOYB
}
225
226 76af8cdb NOYB
# Manage Log - Section/Form
227 c05363c8 NOYB
if (!$system_logs_manage_log_form_hidden) {
228
	manage_log_section();
229
}
230 e3efcb23 NOYB
?>
231 33d52df1 sbeaver
232 c10cb196 Stephen Beaver
<?php include("foot.inc"); ?>