Project

General

Profile

Download (5.68 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-2018 Rubicon Communications, LLC (Netgate)
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 REQUEST argument. Default to 'system' logs
68
if (!$_REQUEST['logfile']) {
69
	$logfile = 'system';
70
} else {
71
	$logfile = $_REQUEST['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
	$pglinks = array("", "status_logs.php", "status_logs.php", "@self");
98
} else {
99
	$pgtitle = array(gettext("Status"), gettext("System Logs"), $allowed_logs[$logfile]["name"]);
100
	$pglinks = array("", "status_logs.php", "@self");
101
}
102
include("head.inc");
103

    
104
if ($changes_applied) {
105
	print_apply_result_box($retval, $extra_save_msg);
106
	$manage_log_active = false;
107
}
108

    
109
// Tab Array
110
tab_array_logs_common();
111

    
112

    
113
// Manage Log - Section/Form
114
if ($system_logs_manage_log_form_hidden) {
115
	manage_log_section();
116
}
117

    
118

    
119
// Filter Section/Form - System
120
filter_form_system();
121

    
122

    
123
// Now the forms are complete we can draw the log table and its controls
124
if (!$rawfilter) {
125
	system_log_filter();
126
?>
127

    
128
<div class="panel panel-default">
129
	<div class="panel-heading">
130
		<h2 class="panel-title">
131
<?php
132
	print(system_log_table_panel_title());
133
?>
134
		</h2>
135
	</div>
136
	<div class="panel-body">
137
	   <div class="table-responsive">
138
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
139
			<thead>
140
				<tr class="text-nowrap">
141
					<th><?=gettext("Time")?></th>
142
					<th><?=gettext("Process")?></th>
143
					<th><?=gettext("PID")?></th>
144
					<th style="width:100%"><?=gettext("Message")?></th>
145
				</tr>
146
			</thead>
147
			<tbody>
148
<?php
149
	foreach ($filterlog as $filterent) {
150
?>
151
				<tr class="text-nowrap">
152
					<td>
153
						<?=htmlspecialchars($filterent['time'])?>
154
					</td>
155
					<td>
156
						<?=htmlspecialchars($filterent['process'])?>
157
					</td>
158
					<td>
159
						<?=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
<?php
166
	} // e-o-foreach
167
?>
168
			</tbody>
169
		</table>
170
<?php
171
	if (count($filterlog) == 0) {
172
		print_info_box(gettext('No logs to display.'));
173
	}
174
?>
175
		</div>
176
	</div>
177
</div>
178
<?php
179
} else {
180
?>
181
<div class="panel panel-default">
182
	<div class="panel-heading">
183
		<h2 class="panel-title">
184
<?php
185
	print(system_log_table_panel_title());
186
?>
187
		</h2>
188
	</div>
189
	<div class="table table-responsive">
190
		<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
191
			<thead>
192
				<tr class="text-nowrap">
193
					<th><?=gettext("Time")?></th>
194
					<th style="width:100%"><?=gettext("Message")?></th>
195
				</tr>
196
			</thead>
197
			<tbody>
198
<?php
199
	if (($logfile == 'resolver') || ($logfile == 'system')) {
200
		$inverse = array("ppp");
201
	} else {
202
		$inverse = null;
203
	}
204

    
205
	system_log_filter();
206
?>
207
			</tbody>
208
		</table>
209

    
210
<script type="text/javascript">
211
//<![CDATA[
212
events.push(function() {
213
	$("#count").html(<?=$rows?>);
214
});
215
//]]>
216
</script>
217

    
218
<?php
219
	if ($rows == 0) {
220
		print_info_box(gettext('No logs to display.'));
221
	}
222
?>
223
	</div>
224
</div>
225
<?php
226
}
227

    
228
# Manage Log - Section/Form
229
if (!$system_logs_manage_log_form_hidden) {
230
	manage_log_section();
231
}
232
?>
233

    
234
<?php include("foot.inc"); ?>
(177-177/234)