Project

General

Profile

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

    
60
/*
61
	pfSense_MODULE:	system
62
*/
63

    
64
##|+PRIV
65
##|*IDENT=page-diagnostics-logs-system
66
##|*NAME=Diagnostics: Logs: System page
67
##|*DESCR=Allow access to the 'Diagnostics: Logs: System' page.
68
##|*MATCH=diag_logs.php*
69
##|-PRIV
70

    
71
require("guiconfig.inc");
72

    
73
// The logs to display are specified in a GET argument. Default to 'system' logs
74
if (!$_GET['logfile'])
75
	$logfile = 'system';
76
else
77
	$logfile = $_GET['logfile'];
78

    
79
$system_logfile = "{$g['varlog_path']}/{$logfile}.log";
80

    
81
$nentries = $config['syslog']['nentries'];
82
if (!$nentries) {
83
	$nentries = 50;
84
}
85

    
86
if ($_POST['clear']) {
87
	clear_log_file($system_logfile);
88
}
89

    
90
if ($_GET['filtertext']) {
91
	$filtertext = htmlspecialchars($_GET['filtertext']);
92
}
93

    
94
if ($_POST['filtertext']) {
95
	$filtertext = htmlspecialchars($_POST['filtertext']);
96
}
97

    
98
if ($filtertext) {
99
	$filtertextmeta="?filtertext=$filtertext";
100
}
101

    
102
$pgtitle = array(gettext("Status"), gettext("System logs"), gettext("General"));
103
include("head.inc");
104

    
105
$tab_array = array();
106
$tab_array[] = array(gettext("System"), ($logfile == 'system'), "diag_logs.php");
107
$tab_array[] = array(gettext("Firewall"), false, "diag_logs_filter.php");
108
$tab_array[] = array(gettext("DHCP"), ($logfile == 'dhcpd'), "diag_logs.php?logfile=dhcpd");
109
$tab_array[] = array(gettext("Portal Auth"), ($logfile == 'portalauth'), "diag_logs.php?logfile=portalauth");
110
$tab_array[] = array(gettext("IPsec"), ($logfile == 'ipsec'), "diag_logs.php?logfile=ipsec");
111
$tab_array[] = array(gettext("PPP"), ($logfile == 'ppp'), "diag_logs.php?logfile=ppp");
112
$tab_array[] = array(gettext("VPN"), false, "diag_logs_vpn.php");
113
$tab_array[] = array(gettext("Load Balancer"), ($logfile == 'relayd'), "diag_logs.php?logfile=relayd");
114
$tab_array[] = array(gettext("OpenVPN"), ($logfile == 'openvpn'), "diag_logs.php?logfile=openvpn");
115
$tab_array[] = array(gettext("NTP"), ($logfile == 'ntpd'), "diag_logs.php?logfile=ntpd");
116
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
117
display_top_tabs($tab_array);
118

    
119
$tab_array = array();
120
if (in_array($logfile, array('system', 'gateways', 'routing', 'resolver', 'wireless')))	 {
121
	$tab_array[] = array(gettext("General"), ($logfile == 'system'), "/diag_logs.php");
122
	$tab_array[] = array(gettext("Gateways"), ($logfile == 'gateways'), "/diag_logs.php?logfile=gateways");
123
	$tab_array[] = array(gettext("Routing"), ($logfile == 'routing'), "/diag_logs.php?logfile=routing");
124
	$tab_array[] = array(gettext("Resolver"), ($logfile == 'resolver'), "/diag_logs.php?logfile=resolver");
125
	$tab_array[] = array(gettext("Wireless"), ($logfile == 'wireless'), "/diag_logs.php?logfile=wireless");
126
	display_top_tabs($tab_array, false, 'nav nav-tabs');
127
}
128

    
129
require_once('classes/Form.class.php');
130

    
131
$form = new Form(false);
132

    
133
$section = new Form_Section('Log file filter');
134

    
135
$section->addInput(new Form_Input(
136
	'filtertext',
137
	'Filter',
138
	'text',
139
	$filtertext,
140
	['placeholder' => 'Filter text']
141
));
142

    
143
$form->addGlobal(new Form_Button(
144
	'filtersubmit',
145
	'Filter'
146
))->removeClass('btn-primary')->addClass('btn-default')->addClass('btn-sm');
147

    
148
$form->addGlobal(new Form_Button(
149
	'clear',
150
	'Clear log'
151
))->removeClass('btn-primary')->addClass('btn-danger')->addClass('btn-sm');
152

    
153
$form->add($section);
154
print $form;
155

    
156
if ($logfile == 'dhcpd')
157
	print_info_box('Warning: Clearing the log file will restart the DHCP daemon.');
158

    
159
?>
160
<div class="panel panel-default">
161
	<div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=$logfile?><?=gettext(" log entries")?></h2></div>
162
	<pre>
163
<?php
164
	if (($logfile == 'resolver') || ($logfile == 'system'))
165
		$inverse = array("ppp");
166
	else
167
		$inverse = null;
168

    
169
	if ($filtertext)
170
		dump_clog_no_table($system_logfile, $nentries, true, array("$filtertext"), $inverse);
171
	else
172
		dump_clog_no_table($system_logfile, $nentries, true, array(), $inverse);
173
?>
174
	</pre>
175
</div>
176

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