diag_logs.php 3.3 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3
/*
4
	Copyright (C) 2014 Deciso B.V.
Ad Schellevis's avatar
Ad Schellevis committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
	Copyright (C) 2004-2009 Scott Ullrich
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
	All rights reserved.

	Redistribution and use in source and binary forms, with or without
	modification, are permitted provided that the following conditions are met:

	1. Redistributions of source code must retain the above copyright notice,
	   this list of conditions and the following disclaimer.

	2. Redistributions in binary form must reproduce the above copyright
	   notice, this list of conditions and the following disclaimer in the
	   documentation and/or other materials provided with the distribution.

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

31
require_once("guiconfig.inc");
Ad Schellevis's avatar
Ad Schellevis committed
32

33
$system_logfile = '/var/log/system.log';
Ad Schellevis's avatar
Ad Schellevis committed
34 35

$nentries = $config['syslog']['nentries'];
36
if (!$nentries) {
Ad Schellevis's avatar
Ad Schellevis committed
37
	$nentries = 50;
38
}
Ad Schellevis's avatar
Ad Schellevis committed
39

40
if ($_POST['clear']) {
Ad Schellevis's avatar
Ad Schellevis committed
41
	clear_log_file($system_logfile);
42
}
Ad Schellevis's avatar
Ad Schellevis committed
43

44
if ($_GET['filtertext']) {
Ad Schellevis's avatar
Ad Schellevis committed
45
	$filtertext = htmlspecialchars($_GET['filtertext']);
46
}
Ad Schellevis's avatar
Ad Schellevis committed
47

48
if ($_POST['filtertext']) {
Ad Schellevis's avatar
Ad Schellevis committed
49
	$filtertext = htmlspecialchars($_POST['filtertext']);
50
}
Ad Schellevis's avatar
Ad Schellevis committed
51

52 53 54
if ($filtertext) {
	$filtertextmeta = "?filtertext={$filtertext}";
}
Ad Schellevis's avatar
Ad Schellevis committed
55 56 57 58 59 60

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

?>

61 62
<body>

Ad Schellevis's avatar
Ad Schellevis committed
63
<?php include("fbegin.inc"); ?>
64 65

	<section class="page-content-main">
66
		<div class="container-fluid">
67
			<div class="row">
68

69
				<?php if ($input_errors) print_input_errors($input_errors); ?>
70

71
			    <section class="col-xs-12">
72

73
				<? include('diag_logs_tabs.inc'); ?>
74 75 76 77 78

					<div class="tab-content content-box col-xs-12">
				    <div class="container-fluid">


79
							<? include('diag_logs_pills.php'); ?>
80 81
				    </div>

82
							 <div class="table-responsive">
83 84
								<table class="table table-striped table-sort">
									<?php
85
										if ($filtertext) {
86
											dump_clog($system_logfile, $nentries, true, array("$filtertext"), array("ppp"));
87
										} else {
88
											dump_clog($system_logfile, $nentries, true, array(), array("ppp"));
89
										}
90
									?>
91
								</table>
92
							 </div>
93

Ad Schellevis's avatar
Ad Schellevis committed
94
							<div class="container-fluid">
95

96 97 98
							<form action="diag_logs.php" method="post">
								<input name="clear" type="submit" class="btn btn-default" value="<?= gettext("Clear log");?>" />
							</form>
99

Ad Schellevis's avatar
Ad Schellevis committed
100
							<form id="clearform" name="clearform" action="diag_logs.php" method="post" class="__mt">
101 102
					<input id="filtertext" name="filtertext" value="<?=$filtertext;?>" />
					<input id="filtersubmit" name="filtersubmit" type="submit" class="btn btn-primary" value="<?=gettext("Filter");?>" />
Ad Schellevis's avatar
Ad Schellevis committed
103
						    </form>
104

Ad Schellevis's avatar
Ad Schellevis committed
105
							</div>
106

107 108
						</div>
				    </div>
109
			</section>
110 111 112
			</div>
		</div>
	</section>
113 114

<?php include("foot.inc"); ?>