diff --git a/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc b/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc
index 8a41d69797abc9c9a13f69dc4e390dbfb22c93db..4c7ed5bc6358949b6fc490251f719a84f89df9a3 100644 (file)
class rsyslog extends plugin
{
- var $plHeadline= "rSyslog";
+ var $plHeadline= "System logs";
var $plDescription= "View system logs";
var $servers = array();
var $search_for ="";
- var $sort_value = "FromHost";
+ var $sort_value = "DeviceReportedTime";
var $sort_type = "DESC";
var $limit = "0";
var $limits = array(20,50,100,200,500,1000,'-');
// Get list of rsyslog servers
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
- $ldap->search("objectClass=rSyslogServer",array("cn","rSyslogUser","rSyslogDatabase","rSyslogPassword"));
+ $ldap->search("objectClass=goLogDBServer",array("cn","goLogAdmin","gosaLogDB","goLogPassword"));
while($attrs = $ldap->fetch()){
if(empty($this->selected_server)) $this->selected_server = $attrs['cn'][0];
$s = array('cn' => $attrs['cn'][0], 'dn' => $attrs['dn'], 'Password' => '', 'status' => 'ok');
- $s['User'] = $attrs['rSyslogUser'][0];
- $s['Database'] = $attrs['rSyslogDatabase'][0];
+ $s['User'] = $attrs['goLogAdmin'][0];
+ $s['Database'] = $attrs['gosaLogDB'][0];
$s['Hosts'] = array();
$s['Priorities'] = array();
$s['ACL'] = "";
- if(isset($attrs['rSyslogPassword'])) $s['Password'] = $attrs['rSyslogPassword'][0];
+ if(isset($attrs['goLogPassword'])) $s['Password'] = $attrs['goLogPassword'][0];
$this->servers[$attrs['cn'][0]] = $s;
}
$smarty->assign("usePrototype", "true");
$ui = get_userinfo();
- if(!isset($this->servers[$this->selected_server]) || !count($this->servers[$this->selected_server]['Hosts'])){
+ if(!isset($this->servers[$this->selected_server]['Hosts']) || !count($this->servers[$this->selected_server]['Hosts'])){
$hosts = array('-' => _("-"));
}else{
$hosts = array('all' => _("All"));
$hosts = array_merge($hosts,$this->servers[$this->selected_server]['Hosts']);
}
- if(!isset($this->servers[$this->selected_server]) || !count($this->servers[$this->selected_server]['Priorities'])){
+ if(!isset($this->servers[$this->selected_server]['Priorities']) || !count($this->servers[$this->selected_server]['Priorities'])){
$priorities = array('-' => _("-"));
}else{
$priorities = array('all' => _("All"));
$smarty->assign("downimg", "<img src='images/lists/sort-down.png' class='center' alt='\\/' border='0'>");
$smarty->assign("upimg", "<img src='images/lists/sort-up.png' class='center' alt='\\/' border='0'>");
$smarty->assign("result", $result);
- if($this->limit != '-'){
+ $smarty->assign("matches", sprintf(_("%s entries match the filter"), $result["count"]));
+ if($this->limits[$this->limit] != '-'){
$smarty->assign("page_sel", range_selector($result['count'],$this->page,$this->limits[$this->limit]));
}else{
$smarty->assign("page_sel", "");
$result['error'] = "";
// Check whether the selected server exists.
- if(!isset($this->servers[$this->selected_server])){
- $this->servers[$name]['status'] = sprintf(_("The selected server '%s' does not exists!"),$this->selected_server);
- $this->servers[$name]['error'] = $this->servers[$this->selected_server]['error'];
+ if($this->selected_server == "unknown" || !isset($this->servers[$this->selected_server])){
+ $this->servers["unknown"]['status'] = sprintf(_("The selected server '%s' does not exists!"),$this->selected_server);
+ $this->servers["unknown"]["cn"] = "-";
return($result);
}
// Check database connectivity
$name = $this->selected_server;
+
+
+
$server = $this->servers[$name];
$link = @mysql_pconnect($server['cn'], $server['User'], $server['Password']);
if ($link === FALSE){
}
// Get log entries matching the selected filter
- if(preg_match('/r/', $this->servers[$name]['ACL'])){
+ if(isset($this->servers[$name]['ACL']) && preg_match('/r/', $this->servers[$name]['ACL'])){
$host = "%%";
if($this->selected_host != "all") $host = $this->selected_host;
if($result['count'] < $this->page) $this->page = 0;
- $filter.= "ORDER BY ".$this->sort_value." ".$this->sort_type." ";
- if($this->limit != "-"){
+ $filter.= "ORDER BY ".$this->sort_value." ".$this->sort_type.", DeviceReportedTime ".$this->sort_type." ";
+ if($this->limits[$this->limit]!= "-"){
$filter.= "LIMIT ".$this->page.", ".$this->limits[$this->limit];
}else{
$this->page = 0;
}
// Get Host
- if( isset($_POST['selected_host']) &&
+ if( isset($this->servers[$this->selected_server]['Hosts']) && isset($_POST['selected_host']) &&
($_POST['selected_host'] == "all" ||
in_array($_POST['selected_host'],$this->servers[$this->selected_server]['Hosts']))){
$this->selected_host = $_POST['selected_host'];
}
// Get priority from post
- if( isset($_POST['selected_priority']) &&
+ if( isset($this->servers[$this->selected_server]['Priorities']) && isset($_POST['selected_priority']) &&
($_POST['selected_priority'] == "all" ||
in_array($_POST['selected_priority'],$this->servers[$this->selected_server]['Priorities']))){
$this->selected_priority = $_POST['selected_priority'];