Project

General

Profile

Download (7.2 KB) Statistics
| Branch: | Tag: | Revision:
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
 * Redistribution and use in source and binary forms, with or without
14
 * modification, are permitted provided that the following conditions are met:
15
 *
16
 * 1. Redistributions of source code must retain the above copyright notice,
17
 *    this list of conditions and the following disclaimer.
18
 *
19
 * 2. Redistributions in binary form must reproduce the above copyright
20
 *    notice, this list of conditions and the following disclaimer in
21
 *    the documentation and/or other materials provided with the
22
 *    distribution.
23
 *
24
 * 3. All advertising materials mentioning features or use of this software
25
 *    must display the following acknowledgment:
26
 *    "This product includes software developed by the pfSense Project
27
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
28
 *
29
 * 4. The names "pfSense" and "pfSense Project" must not be used to
30
 *    endorse or promote products derived from this software without
31
 *    prior written permission. For written permission, please contact
32
 *    coreteam@pfsense.org.
33
 *
34
 * 5. Products derived from this software may not be called "pfSense"
35
 *    nor may "pfSense" appear in their names without prior written
36
 *    permission of the Electric Sheep Fencing, LLC.
37
 *
38
 * 6. Redistributions of any form whatsoever must retain the following
39
 *    acknowledgment:
40
 *
41
 * "This product includes software developed by the pfSense Project
42
 * for use in the pfSense software distribution (http://www.pfsense.org/).
43
 *
44
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
45
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
46
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
47
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
48
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
49
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
50
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
51
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
53
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
54
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
55
 * OF THE POSSIBILITY OF SUCH DAMAGE.
56
 */
57

    
58
##|+PRIV
59
##|*IDENT=page-diagnostics-logs-system
60
##|*NAME=Status: Logs: System
61
##|*DESCR=Allow access to the 'Status: System Logs: General' page.
62
##|*MATCH=status_logs.php
63
##|-PRIV
64

    
65
require_once("status_logs_common.inc");
66

    
67

    
68
/*
69
Build a list of allowed log files so we can reject others to prevent the page
70
from acting on unauthorized files.
71
*/
72
$allowed_logs = array(
73
	"system" => array("name" => gettext("General"),
74
		    "shortcut" => ""),
75
	"dhcpd" => array("name" => gettext("DHCP"),
76
		    "shortcut" => "dhcp"),
77
	"portalauth" => array("name" => gettext("Captive Portal Auth"),
78
		    "shortcut" => "captiveportal"),
79
	"ipsec" => array("name" => gettext("IPsec"),
80
		    "shortcut" => "ipsec"),
81
	"ppp" => array("name" => gettext("PPP"),
82
		    "shortcut" => ""),
83
	"relayd" => array("name" => gettext("Load Balancer"),
84
		    "shortcut" => "relayd"),
85
	"openvpn" => array("name" => gettext("OpenVPN"),
86
		    "shortcut" => "openvpn"),
87
	"ntpd" => array("name" => gettext("NTP"),
88
		    "shortcut" => "ntp"),
89
	"gateways" => array("name" => gettext("Gateways"),
90
		    "shortcut" => "gateways"),
91
	"routing" => array("name" => gettext("Routing"),
92
		    "shortcut" => "routing"),
93
	"resolver" => array("name" => gettext("DNS Resolver"),
94
		    "shortcut" => "resolver"),
95
	"wireless" => array("name" => gettext("Wireless"),
96
		    "shortcut" => "wireless"),
97
);
98

    
99
// The logs to display are specified in a GET argument. Default to 'system' logs
100
if (!$_GET['logfile']) {
101
	$logfile = 'system';
102
} else {
103
	$logfile = $_GET['logfile'];
104
	if (!array_key_exists($logfile, $allowed_logs)) {
105
		/* Do not let someone attempt to load an unauthorized log. */
106
		$logfile = 'system';
107
	}
108
}
109

    
110

    
111
// Log Filter Submit - System
112
log_filter_form_system_submit();
113

    
114

    
115
// Manage Log Section - Code
116
manage_log_code();
117

    
118

    
119
// Status Logs Common - Code
120
status_logs_common_code();
121

    
122

    
123
if ($filtertext) {
124
	$filtertextmeta="?filtertext=$filtertext";
125
}
126

    
127
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless'))) {
128
	$pgtitle = array(gettext("Status"), gettext("System Logs"), gettext("System"), $allowed_logs[$logfile]["name"]);
129
} else {
130
	$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
131
}
132
include("head.inc");
133

    
134
if (!$input_errors && $savemsg) {
135
	print_info_box($savemsg, 'success');
136
	$manage_log_active = false;
137
}
138

    
139
// Tab Array
140
tab_array_logs_common();
141

    
142

    
143
// Manage Log - Section/Form
144
if ($system_logs_manage_log_form_hidden) {
145
	manage_log_section();
146
}
147

    
148

    
149
// Filter Section/Form - System
150
filter_form_system();
151

    
152

    
153
// Now the forms are complete we can draw the log table and its controls
154
if (!$rawfilter) {
155
	system_log_filter();
156
?>
157

    
158
<div class="panel panel-default">
159
	<div class="panel-heading">
160
		<h2 class="panel-title">
161
<?php
162
	print(system_log_table_panel_title());
163
?>
164
		</h2>
165
	</div>
166
	<div class="panel-body">
167
	   <div class="table-responsive">
168
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
169
			<thead>
170
				<tr class="text-nowrap">
171
					<th><?=gettext("Time")?></th>
172
					<th><?=gettext("Process")?></th>
173
					<th><?=gettext("PID")?></th>
174
					<th style="width:100%"><?=gettext("Message")?></th>
175
				</tr>
176
			</thead>
177
			<tbody>
178
<?php
179
	foreach ($filterlog as $filterent) {
180
?>
181
				<tr class="text-nowrap">
182
					<td>
183
						<?=htmlspecialchars($filterent['time'])?>
184
					</td>
185
					<td>
186
						<?=htmlspecialchars($filterent['process'])?>
187
					</td>
188
					<td>
189
						<?=htmlspecialchars($filterent['pid'])?>
190
					</td>
191
					<td style="word-wrap:break-word; word-break:break-all; white-space:normal">
192
						<?=htmlspecialchars($filterent['message'])?>
193
					</td>
194
				</tr>
195
<?php
196
	} // e-o-foreach
197
?>
198
			</tbody>
199
		</table>
200
<?php
201
	if (count($filterlog) == 0) {
202
		print_info_box(gettext('No logs to display.'));
203
	}
204
?>
205
		</div>
206
	</div>
207
</div>
208
<?php
209
} else {
210
?>
211
<div class="panel panel-default">
212
	<div class="panel-heading">
213
		<h2 class="panel-title">
214
<?php
215
	print(system_log_table_panel_title());
216
?>
217
		</h2>
218
	</div>
219
	<div class="table table-responsive">
220
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
221
			<thead>
222
				<tr class="text-nowrap">
223
					<th><?=gettext("Time")?></th>
224
					<th style="width:100%"><?=gettext("Message")?></th>
225
				</tr>
226
			</thead>
227
			<tbody>
228
<?php
229
	if (($logfile == 'resolver') || ($logfile == 'system')) {
230
		$inverse = array("ppp");
231
	} else {
232
		$inverse = null;
233
	}
234

    
235
	system_log_filter();
236
?>
237
			</tbody>
238
		</table>
239

    
240
<script type="text/javascript">
241
//<![CDATA[
242
events.push(function() {
243
	$("#count").html(<?=$rows?>);
244
});
245
//]]>
246
</script>
247

    
248
<?php
249
	if ($rows == 0) {
250
		print_info_box(gettext('No logs to display.'));
251
	}
252
?>
253
	</div>
254
</div>
255
<?php
256
}
257

    
258
# Manage Log - Section/Form
259
if (!$system_logs_manage_log_form_hidden) {
260
	manage_log_section();
261
}
262
?>
263

    
264
<?php include("foot.inc"); ?>
(170-170/225)