Esempio n. 1
0
File: clog.php Progetto: MrWnn/cacti
 | Copyright (C) 2004-2015 The Cacti Group                                 |
 |                                                                         |
 | This program is free software; you can redistribute it and/or           |
 | modify it under the terms of the GNU General Public License             |
 | as published by the Free Software Foundation; either version 2          |
 | of the License, or (at your option) any later version.                  |
 |                                                                         |
 | This program is distributed in the hope that it will be useful,         |
 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
 | GNU General Public License for more details.                            |
 +-------------------------------------------------------------------------+
 | Cacti: The Complete RRDTool-based Graphing Solution                     |
 +-------------------------------------------------------------------------+
 | This code is designed, written, and maintained by the Cacti Group. See  |
 | about.php and/or the AUTHORS file for specific developer information.   |
 +-------------------------------------------------------------------------+
 | http://www.cacti.net/                                                   |
 +-------------------------------------------------------------------------+
*/
$guest_account = true;
include './include/auth.php';
include_once './lib/utility.php';
include_once './lib/clog_webapi.php';
/* check edit/alter permissions */
if (!clog_admin()) {
    echo 'FATAL: YOU DO NO HAVE ACCESS TO THIS AREA OF CACTI';
    exit;
}
load_current_session_value('page_referrer', 'page_referrer', '');
clog_view_logfile();
Esempio n. 2
0
function filter()
{
    global $page_refresh_interval, $log_tail_lines;
    ?>
	<tr class='even'>
		<form name='form_logfile'>
		<td>
			<table cellpadding='2' cellspacing='0'>
				<tr>
					<td width='85' style='white-space: nowrap;'>
						Tail Lines
					</td>
					<td>
						<select id='tail_lines' name='tail_lines'>
							<?php 
    foreach ($log_tail_lines as $tail_lines => $display_text) {
        print "<option value='" . $tail_lines . "'";
        if ($_REQUEST['tail_lines'] == $tail_lines) {
            print ' selected';
        }
        print '>' . $display_text . "</option>\n";
    }
    ?>
						</select>
					</td>
					<td style='white-space: nowrap;'>
						Message Type
					</td>
					<td width='1'>
						<select id='message_type' name='message_type'>
							<option value='-1'<?php 
    if ($_REQUEST['message_type'] == '-1') {
        ?>
 selected<?php 
    }
    ?>
>All</option>
							<option value='1'<?php 
    if ($_REQUEST['message_type'] == '1') {
        ?>
 selected<?php 
    }
    ?>
>Stats</option>
							<option value='2'<?php 
    if ($_REQUEST['message_type'] == '2') {
        ?>
 selected<?php 
    }
    ?>
>Warnings</option>
							<option value='3'<?php 
    if ($_REQUEST['message_type'] == '3') {
        ?>
 selected<?php 
    }
    ?>
>Errors</option>
							<option value='4'<?php 
    if ($_REQUEST['message_type'] == '4') {
        ?>
 selected<?php 
    }
    ?>
>Debug</option>
							<option value='5'<?php 
    if ($_REQUEST['message_type'] == '5') {
        ?>
 selected<?php 
    }
    ?>
>SQL Calls</option>
						</select>
					</td>
					<td>
						<input type='button' id='go' name='go' value='Go' alt='Go' border='0' align='absmiddle'>
					</td>
					<td>
						<input type='button' id='clear' name='clear' value='Clear' alt='Clear' border='0' align='absmiddle'>
					</td>
					<td>
						<?php 
    if (clog_admin()) {
        ?>
<input type='button' id='purge' name='purge' value='Purge' alt='Purge' border='0' align='absmiddle'><?php 
    }
    ?>
					</td>
				</tr>
				<tr>
					<td width='85'>
						Refresh
					</td>
					<td>
						<select id='refresh' name='refresh'>
							<?php 
    foreach ($page_refresh_interval as $seconds => $display_text) {
        print "<option value='" . $seconds . "'";
        if ($_REQUEST['refresh'] == $seconds) {
            print ' selected';
        }
        print '>' . $display_text . "</option>\n";
    }
    ?>
						</select>
					</td>
					<td style='white-space: nowrap;'>
						Display Order
					</td>
					<td>
						<select id='reverse' name='reverse'>
							<option value='1'<?php 
    if ($_REQUEST['reverse'] == '1') {
        ?>
 selected<?php 
    }
    ?>
>Newest First</option>
							<option value='2'<?php 
    if ($_REQUEST['reverse'] == '2') {
        ?>
 selected<?php 
    }
    ?>
>Oldest First</option>
						</select>
					</td>
				</tr>
			</table>
			<table cellpadding='2' cellspacing='0'>
				<tr>
					<td width='85'>
						SearchRegex
					</td>
					<td>
						<input id='filter' type='text' name='filter' size='75' value='<?php 
    print $_REQUEST['filter'];
    ?>
'>
					</td>
				</tr>
			</table>
			<script type='text/javascript'>
			$('#filter').change(function() {
				refreshFilter();
			});

			$('#reverse').change(function() {
				refreshFilter();
			});

			$('#refresh').change(function() {
				refreshFilter();
			});

			$('#message_type').change(function() {
				refreshFilter();
			});

			$('#tail_lines').change(function() {
				refreshFilter();
			});

			$('#go').click(function() {
				refreshFilter();
			});

			$('#clear').click(function() {
				clearFilter();
			});

			$('#purge').click(function() {
				var url='?purge=1&header=false';
				$.get(basename(location.pathname)+url, function(data) {
					$('#main').html(data);
					applySkin();
				});
			});

			function clearFilter() {
				var url='?clear=1&header=false';
				$.get(basename(location.pathname)+url, function(data) {
					$('#main').html(data);
					applySkin();
				});
			}

			function refreshFilter() {
				refreshMSeconds=$('#refresh').val()*1000;

				var url='?filter='+ $('#filter').val()+
					'&reverse='+$('#reverse').val()+
					'&refresh='+$('#refresh').val()+
					'&message_type='+$('#message_type').val()+
					'&tail_lines='+$('#tail_lines').val()+
					'&header=false';

				$.get(basename(location.pathname)+url, function(data) {
					$('#main').html(data);
					applySkin();
				});
			}
			</script>
		</form>
		</td>
	</tr>
	<?php 
}