Project

General

Profile

Download (4.39 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	diag_logs.php
5
	Copyright (C) 2004 Scott Ullrich
6
	All rights reserved.
7

    
8
	originally part of m0n0wall (http://m0n0.ch/wall)
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
10
	All rights reserved.
11

    
12
	Redistribution and use in source and binary forms, with or without
13
	modification, 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 the
20
	   documentation and/or other materials provided with the distribution.
21

    
22
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
	POSSIBILITY OF SUCH DAMAGE.
32
*/
33

    
34
##|+PRIV
35
##|*IDENT=page-diagnostics-logs-system
36
##|*NAME=Diagnostics: Logs: System page
37
##|*DESCR=Allow access to the 'Diagnostics: Logs: System' page.
38
##|*MATCH=diag_logs.php*
39
##|-PRIV
40

    
41

    
42
require("guiconfig.inc");
43

    
44
$system_logfile = "{$g['varlog_path']}/system.log";
45

    
46
$nentries = $config['syslog']['nentries'];
47
if (!$nentries)
48
	$nentries = 50;
49

    
50
if ($_POST['clear']) {
51
	if(isset($config['system']['disablesyslogclog'])) {
52
		exec("killall syslogd");
53
		unlink($syslog_logfile);
54
		touch($syslog_logfile);
55
		system_syslogd_start();
56
	} else {  
57
		exec("killall syslogd");
58
		exec("/usr/sbin/clog -i -s 262144 {$system_logfile}");
59
		system_syslogd_start();
60
	}
61

    
62
}
63

    
64
if ($_GET['filtertext'])
65
	$filtertext = $_GET['filtertext'];
66

    
67
if ($_POST['filtertext'])
68
	$filtertext = $_POST['filtertext'];
69

    
70
if ($filtertext)
71
	$filtertextmeta="?filtertext=$filtertext";
72

    
73
$pgtitle = array("Status","System logs","System");
74
include("head.inc");
75

    
76
?>
77

    
78
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
79
<?php include("fbegin.inc"); ?>
80
<table width="100%" border="0" cellpadding="0" cellspacing="0">
81
	<tr>
82
		<td>
83
<?php
84
	$tab_array = array();
85
	$tab_array[] = array("System", true, "diag_logs.php");
86
	$tab_array[] = array("Firewall", false, "diag_logs_filter.php");
87
	$tab_array[] = array("DHCP", false, "diag_logs_dhcp.php");
88
	$tab_array[] = array("Portal Auth", false, "diag_logs_auth.php");
89
	$tab_array[] = array("IPsec VPN", false, "diag_logs_ipsec.php");
90
	$tab_array[] = array("PPTP VPN", false, "diag_logs_vpn.php");
91
	$tab_array[] = array("Load Balancer", false, "diag_logs_slbd.php");
92
	$tab_array[] = array("OpenVPN", false, "diag_logs_openvpn.php");
93
	$tab_array[] = array("OpenNTPD", false, "diag_logs_ntpd.php");
94
	$tab_array[] = array("Settings", false, "diag_logs_settings.php");
95
	display_top_tabs($tab_array);
96
?>
97
		</td>
98
	</tr>
99
	<tr>
100
		<td>
101
			<div id="mainarea">
102
			<table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="0">
103
				<tr>
104
					<td colspan="2" class="listtopic">Last <?=$nentries;?> system log entries</td>
105
				</tr>
106
				<?php
107
					if($filtertext)
108
						dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("racoon", "ntpd", "pppoe"));
109
					else
110
						dump_clog($system_logfile, $nentries, true, array(), array("racoon", "ntpd", "pppoe"));
111
				?>
112
				<tr>
113
					<td align="left" valign="top">
114
						<form id="filterform" name="filterform" action="diag_logs.php" method="post" style="margin-top: 14px;">
115
              				<input id="submit" name="clear" type="submit" class="formbtn" value="<?=gettext("Clear log");?>" />
116
						</form>
117
					</td>
118
					<td align="right" valign="top" >
119
						<form id="clearform" name="clearform" action="diag_logs.php" method="post" style="margin-top: 14px;">
120
              				<input id="filtertext" name="filtertext" value="<?=gettext($filtertext);?>" />
121
              				<input id="filtersubmit" name="filtersubmit" type="submit" class="formbtn" value="<?=gettext("Filter");?>" />
122
						</form>
123
					</td>
124
				</tr>
125
			</table>
126
	    	</div>
127
		</td>
128
	</tr>
129
</table>
130
<?php include("fend.inc"); ?>
131
</body>
132
</html>
(13-13/216)