Commit d7f14d3f authored by tbrehm's avatar tbrehm
Browse files

enable ispconfig logging in database.

parent b7c43a6d
...@@ -38,7 +38,7 @@ class listform { ...@@ -38,7 +38,7 @@ class listform {
private $pagingValues; private $pagingValues;
private $searchChanged = 0; private $searchChanged = 0;
private $module; private $module;
private $dateformat = 'd.m.Y'; private $dateformat = 'Y-m-d H:i';
public $wordbook; public $wordbook;
public function loadListDef($file, $module = '') public function loadListDef($file, $module = '')
......
...@@ -45,8 +45,8 @@ $liste['auth'] = 'no'; ...@@ -45,8 +45,8 @@ $liste['auth'] = 'no';
*****************************************************/ *****************************************************/
$liste["item"][] = array( 'field' => "tstamp", $liste["item"][] = array( 'field' => "tstamp",
'datatype' => "VARCHAR", 'datatype' => "DATE",
'formtype' => "DATE", 'formtype' => "TEXT",
'op' => "like", 'op' => "like",
'prefix' => "", 'prefix' => "",
'suffix' => "", 'suffix' => "",
......
...@@ -45,8 +45,8 @@ $liste['auth'] = 'no'; ...@@ -45,8 +45,8 @@ $liste['auth'] = 'no';
*****************************************************/ *****************************************************/
$liste["item"][] = array( 'field' => "tstamp", $liste["item"][] = array( 'field' => "tstamp",
'datatype' => "VARCHAR", 'datatype' => "DATE",
'formtype' => "DATE", 'formtype' => "TEXT",
'op' => "like", 'op' => "like",
'prefix' => "", 'prefix' => "",
'suffix' => "", 'suffix' => "",
......
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
<tbody> <tbody>
<tmpl_loop name="records"> <tmpl_loop name="records">
<tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>"> <tr class="tbl_row_<tmpl_if name='__EVEN__'}even<tmpl_else>uneven</tmpl_if>">
<td class="tbl_col_tstamp"><a href="#" onClick="loadContent('admin/datalog_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="tstamp"}</a></td> <td class="tbl_col_tstamp">{tmpl_var name="tstamp"}</td>
<td class="tbl_col_server_id"><a href="#" onClick="loadContent('admin/datalog_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="server_id"}</a></td> <td class="tbl_col_server_id">{tmpl_var name="server_id"}</td>
<td class="tbl_col_action"><a href="#" onClick="loadContent('admin/datalog_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="action"}</a></td> <td class="tbl_col_action">{tmpl_var name="action"}</td>
<td class="tbl_col_dbtable"><a href="#" onClick="loadContent('admin/datalog_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="dbtable"}</a></td> <td class="tbl_col_dbtable">{tmpl_var name="dbtable"}</td>
<td class="tbl_col_status"><a href="#" onClick="loadContent('admin/datalog_edit.php?id={tmpl_var name='id'}');">{tmpl_var name="status"}</a></td> <td class="tbl_col_status">{tmpl_var name="status"}</td>
<td class="tbl_col_buttons"> <td class="tbl_col_buttons">
<div class="buttons icons16"> <div class="buttons icons16">
<a class="icons16 icoDelete" href="javascript: del_record('admin/datalog_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> <!--<a class="icons16 icoDelete" href="javascript: del_record('admin/datalog_del.php?id={tmpl_var name='id'}&phpsessid={tmpl_var name='phpsessid'}','{tmpl_var name='delete_confirmation'}');"><span>{tmpl_var name='delete_txt'}</span></a> -->
</div> </div>
</td> </td>
</tr> </tr>
......
...@@ -125,9 +125,18 @@ foreach($records as $rec) { ...@@ -125,9 +125,18 @@ foreach($records as $rec) {
} }
} }
#######################################################################################################
// Cleanup logs in database
#######################################################################################################
//* Keep 7 days in sys_log
$tstamp = time() - (60*60*24*7);
$sql = "DELETE FROM sys_log WHERE tstamp < $tstamp";
$app->db->query($sql);
//* Keep 7 days in sys_datalog
$tstamp = time() - (60*60*24*7);
$sql = "DELETE FROM sys_datalog WHERE tstamp < $tstamp";
$app->db->query($sql);
die("finished.\n"); die("finished.\n");
......
...@@ -125,6 +125,14 @@ class app { ...@@ -125,6 +125,14 @@ class app {
} }
echo date("d.m.Y-H:i")." - ".$priority_txt." - ". $msg."\n"; echo date("d.m.Y-H:i")." - ".$priority_txt." - ". $msg."\n";
fclose($fp); fclose($fp);
// Log to database
$server_id = $conf['server_id'];
$loglevel = $priority;
$tstamp = time();
$message = $app->db->quote($msg);
$sql = "INSERT INTO sys_log (server_id,loglevel,tstamp,message) VALUES ('$server_id','$loglevel','$tstamp','$message')";
$app->db->query($sql);
//} else { //} else {
// die("Unable to write to logfile."); // die("Unable to write to logfile.");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment