Project

General

Profile

Download (7.16 KB) Statistics
| Branch: | Tag: | Revision:
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 Authentication"),
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("NTPd"),
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
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext($allowed_logs[$logfile]["name"]));
129
include("head.inc");
130

    
131
if (!$input_errors && $savemsg) {
132
	print_info_box($savemsg, 'success');
133
	$manage_log_active = false;
134
}
135

    
136
// Tab Array
137
tab_array_logs_common();
138

    
139

    
140
// Manage Log - Section/Form
141
if ($system_logs_manage_log_form_hidden) {
142
	manage_log_section();
143
}
144

    
145

    
146
// Filter Section/Form - System
147
filter_form_system();
148

    
149

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

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

    
232
	system_log_filter();
233
?>
234
			</tbody>
235
		</table>
236

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

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

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

    
263
<?php include("foot.inc"); ?>
(170-170/229)