diff --git a/web/ajax/log.php b/web/ajax/log.php index c01fd8dae..1e565424c 100644 --- a/web/ajax/log.php +++ b/web/ajax/log.php @@ -31,6 +31,13 @@ switch ( $_REQUEST['task'] ) if ( !canView( 'System' ) ) ajaxError( 'Insufficient permissions to view log entries' ); + $servers = Server::find_all(); + $servers_by_Id = array(); + # There is probably a better way to do this. + foreach ( $servers as $server ) { + $servers_by_Id[$server->Id()] = $server; + } + $minTime = isset($_POST['minTime'])?$_POST['minTime']:NULL; $maxTime = isset($_POST['maxTime'])?$_POST['maxTime']:NULL; $limit = isset($_POST['limit'])?$_POST['limit']:100; @@ -66,6 +73,7 @@ switch ( $_REQUEST['task'] ) $logs = array(); foreach ( dbFetchAll( $sql, NULL, $values ) as $log ) { $log['DateTime'] = preg_replace( '/^\d+/', strftime( "%Y-%m-%d %H:%M:%S", intval($log['TimeKey']) ), $log['TimeKey'] ); + $log['Server'] = $log['ServerId'] ? $servers_by_Id[$log['ServerId']]->Name() : ''; $logs[] = $log; } $options = array(); @@ -96,6 +104,12 @@ switch ( $_REQUEST['task'] ) else $options[$field][$value] = "DB".$value; } + elseif ( $field == 'ServerId' ) + { + foreach( dbFetchAll( $sql, $field, array_values($fieldValues) ) as $value ) + $options['ServerId'][$value] = $value ? $servers_by_Id[$value]->Name() : ''; + + } else { foreach( dbFetchAll( $sql, $field, array_values( $fieldValues ) ) as $value ) diff --git a/web/skins/classic/views/js/log.js b/web/skins/classic/views/js/log.js index 011c4beb0..e6f7fa30e 100644 --- a/web/skins/classic/views/js/log.js +++ b/web/skins/classic/views/js/log.js @@ -22,7 +22,7 @@ var logTimeout = maxSampleTime; var firstLoad = true; var initialDisplayLimit = 200; var sortReversed = false; -var filterFields = [ 'Component', 'Server', 'Pid', 'Level', 'File', 'Line']; +var filterFields = [ 'Component', 'ServerId', 'Pid', 'Level', 'File', 'Line']; var options = {}; function buildFetchParms( parms ) @@ -163,6 +163,12 @@ function filterLog() function( field ) { var selector = $('filter['+field+']'); + if ( ! selector ) { + if ( window.console && window.console.log ) { + window.console.log("No selector found for " + field ); + } + return; + } var value = selector.get('value'); if ( value ) filter[field] = value; @@ -244,6 +250,12 @@ function updateFilterSelectors() function( values, key ) { var selector = $('filter['+key+']'); + if ( ! selector ) { + if ( window.console && window.console.log ) { + window.console.log("No selector found for " + key ); + } + return; + } selector.options.length = 1; if ( key == 'Level' ) { @@ -253,6 +265,15 @@ function updateFilterSelectors() selector.options[selector.options.length] = new Option( value, label ); } ); + } + else if ( key == 'ServerId' ) + { + Object.each(values, + function( value, label ) + { + selector.options[selector.options.length] = new Option( value, label ); + } + ); } else { diff --git a/web/skins/classic/views/log.php b/web/skins/classic/views/log.php index 93b2c0b39..50ba58d42 100644 --- a/web/skins/classic/views/log.php +++ b/web/skins/classic/views/log.php @@ -54,7 +54,7 @@ xhtmlHeaders(__FILE__, translate('SystemLog') );
- - +