X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Frsyslog%2Faddons%2Frsyslog%2Fclass_rsyslog.inc;h=4c7ed5bc6358949b6fc490251f719a84f89df9a3;hb=abcc9081a3bffb38a32efb30319de1954097a879;hp=8a41d69797abc9c9a13f69dc4e390dbfb22c93db;hpb=fb274b4813b7e21018b9d0eaef949ff6098e900f;p=gosa.git
diff --git a/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc b/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc
index 8a41d6979..4c7ed5bc6 100644
--- a/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc
+++ b/gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc
@@ -2,7 +2,7 @@
class rsyslog extends plugin
{
- var $plHeadline= "rSyslog";
+ var $plHeadline= "System logs";
var $plDescription= "View system logs";
var $servers = array();
@@ -15,7 +15,7 @@ class rsyslog extends plugin
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,'-');
@@ -32,16 +32,16 @@ class rsyslog extends plugin
// 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;
}
@@ -104,13 +104,13 @@ class rsyslog extends plugin
$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"));
@@ -139,7 +139,8 @@ class rsyslog extends plugin
$smarty->assign("downimg", "
");
$smarty->assign("upimg", "
");
$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", "");
@@ -157,14 +158,17 @@ class rsyslog extends plugin
$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){
@@ -181,7 +185,7 @@ class rsyslog extends plugin
}
// 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;
@@ -211,8 +215,8 @@ class rsyslog extends plugin
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;
@@ -251,14 +255,14 @@ class rsyslog extends plugin
}
// 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'];