new QuickQuery Functionality (QQ) - implemented for sys saimod log
This commit is contained in:
parent
c0f3cee120
commit
cf968381bd
@ -23,10 +23,12 @@ spl_autoload_register('__autoload_system');
|
|||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/page','SYSTEM\PAGE');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/page','SYSTEM\PAGE');
|
||||||
|
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbd/tbl/','SYSTEM\DBD');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbd/tbl/','SYSTEM\DBD');
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/dbd/qq/','SYSTEM\DBD');
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db','SYSTEM\DB');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db','SYSTEM\DB');
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/dbinfo','SYSTEM\DB');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/dbinfo','SYSTEM\DB');
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/connection','SYSTEM\DB');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/connection','SYSTEM\DB');
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/result','SYSTEM\DB');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/result','SYSTEM\DB');
|
||||||
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/db/qq','SYSTEM\DB');
|
||||||
|
|
||||||
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/security','SYSTEM\SECURITY');
|
\SYSTEM\autoload::registerFolder(dirname(__FILE__).'/security','SYSTEM\SECURITY');
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,10 @@ class Connection extends ConnectionAbstr{
|
|||||||
//private $dbinfo = NULL;
|
//private $dbinfo = NULL;
|
||||||
|
|
||||||
//Connects to DB, dependent on DBInfo a connection to a PG or MYS will be established
|
//Connects to DB, dependent on DBInfo a connection to a PG or MYS will be established
|
||||||
public function __construct(DBInfo $dbinfo){
|
public function __construct(DBInfo $dbinfo = null){
|
||||||
//$this->dbinfo = $dbinfo;
|
//$this->dbinfo = $dbinfo;
|
||||||
|
if(!$dbinfo){
|
||||||
|
$dbinfo = \SYSTEM\system::getSystemDBInfo();}
|
||||||
|
|
||||||
if($dbinfo instanceof \SYSTEM\DB\DBInfoPG){
|
if($dbinfo instanceof \SYSTEM\DB\DBInfoPG){
|
||||||
$this->connection = new \SYSTEM\DB\ConnectionPG($dbinfo);
|
$this->connection = new \SYSTEM\DB\ConnectionPG($dbinfo);
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class ConnectionMYS extends ConnectionAbstr {
|
|||||||
if(!mysqli_stmt_execute($prepStmt)){
|
if(!mysqli_stmt_execute($prepStmt)){
|
||||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
|
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \mysqli_stmt_error($prepStmt));}
|
||||||
|
|
||||||
return new ResultMysqliPrepare($prepStmt);
|
return new ResultMysqliPrepare($prepStmt,$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close(){
|
public function close(){
|
||||||
|
|||||||
@ -38,7 +38,7 @@ class ConnectionPG extends ConnectionAbstr {
|
|||||||
if(!$result)
|
if(!$result)
|
||||||
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \pg_last_error($this->connection));
|
throw new \SYSTEM\LOG\ERROR("Could not execute prepare statement: ". \pg_last_error($this->connection));
|
||||||
|
|
||||||
return new ResultPostgres($result);
|
return new ResultPostgres($result,$this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function close(){
|
public function close(){
|
||||||
|
|||||||
28
db/qq/QP.php
Normal file
28
db/qq/QP.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DB;
|
||||||
|
|
||||||
|
class QP {
|
||||||
|
public static function QQ($params){
|
||||||
|
$query = static::query();
|
||||||
|
$con = new \SYSTEM\DB\Connection($query->dbinfo);
|
||||||
|
if($is_pg = \SYSTEM\system::isSystemDbInfoPG() && $query->dbinfo){
|
||||||
|
$is_pg = $query->dbinfo instanceof \SYSTEM\DB\DBInfoPG;}
|
||||||
|
if($is_pg){
|
||||||
|
return $con->prepare($query->name,$query->sql_pg,$params);
|
||||||
|
} else {
|
||||||
|
return $con->prepare($query->name,$query->sql_mys,$params);}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function QA($params){
|
||||||
|
$res = self::QQ($params);
|
||||||
|
$result = array();
|
||||||
|
while($row = $res->next()){
|
||||||
|
$result[] = $row;}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//override this
|
||||||
|
protected static function query(){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('query function of your QQ Object not overritten!');}
|
||||||
|
//return new QQuery();}
|
||||||
|
}
|
||||||
28
db/qq/QQ.php
Normal file
28
db/qq/QQ.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DB;
|
||||||
|
|
||||||
|
class QQ {
|
||||||
|
public static function QQ(){
|
||||||
|
$query = static::query();
|
||||||
|
$con = new \SYSTEM\DB\Connection($query->dbinfo);
|
||||||
|
if($is_pg = \SYSTEM\system::isSystemDbInfoPG() && $query->dbinfo){
|
||||||
|
$is_pg = $query->dbinfo instanceof \SYSTEM\DB\DBInfoPG;}
|
||||||
|
if($is_pg){
|
||||||
|
return $con->query($query->sql_pg);
|
||||||
|
} else {
|
||||||
|
return $con->query($query->sql_mys);}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function QA(){
|
||||||
|
$res = self::QQ();
|
||||||
|
$result = array();
|
||||||
|
while($row = $res->next()){
|
||||||
|
$result[] = $row;}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
//override this
|
||||||
|
protected static function query(){
|
||||||
|
throw new \SYSTEM\LOG\ERROR('query function of your QQ Object not overritten!');}
|
||||||
|
//return new QQuery();}
|
||||||
|
}
|
||||||
16
db/qq/QQuery.php
Normal file
16
db/qq/QQuery.php
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DB;
|
||||||
|
|
||||||
|
class QQuery{
|
||||||
|
public $name = null;
|
||||||
|
public $sql_pg = null;
|
||||||
|
public $sql_mys = null;
|
||||||
|
public $dbinfo = null;
|
||||||
|
|
||||||
|
public function __construct($name,$sql_pg=null,$sql_mys=null,$dbinfo = null){
|
||||||
|
$this->name = $name;
|
||||||
|
$this->sql_pg = $sql_pg;
|
||||||
|
$this->sql_mys = $sql_mys;
|
||||||
|
$this->dbinfo = $dbinfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,10 +7,12 @@ class ResultMysqliPrepare extends \SYSTEM\DB\Result{
|
|||||||
private $res = NULL;
|
private $res = NULL;
|
||||||
private $meta = NULL;
|
private $meta = NULL;
|
||||||
private $binds = array();
|
private $binds = array();
|
||||||
|
private $connection = NULL;
|
||||||
|
|
||||||
//Result from mysql_query
|
//Result from mysql_query
|
||||||
public function __construct($res){
|
public function __construct($res,$connection){
|
||||||
$this->res = $res;
|
$this->res = $res;
|
||||||
|
$this->connection = $connection;
|
||||||
|
|
||||||
$this->meta = \mysqli_stmt_result_metadata($this->res);
|
$this->meta = \mysqli_stmt_result_metadata($this->res);
|
||||||
|
|
||||||
|
|||||||
@ -6,10 +6,12 @@ class ResultPostgres extends \SYSTEM\DB\Result{
|
|||||||
|
|
||||||
private $res = NULL;
|
private $res = NULL;
|
||||||
private $current = NULL;
|
private $current = NULL;
|
||||||
|
private $connection = NULL;
|
||||||
|
|
||||||
//Result from mysql_query
|
//Result from mysql_query
|
||||||
public function __construct($res){
|
public function __construct($res,$connection){
|
||||||
$this->res = $res;}
|
$this->res = $res;
|
||||||
|
$this->connection = $connection;}
|
||||||
|
|
||||||
public function __destruct(){
|
public function __destruct(){
|
||||||
$this->close();}
|
$this->close();}
|
||||||
|
|||||||
28
dbd/qq/SYS_SAIMOD_LOG_BASIC_QUERYTIME.php
Normal file
28
dbd/qq/SYS_SAIMOD_LOG_BASIC_QUERYTIME.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_BASIC_QUERYTIME extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'avg('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_avg,'
|
||||||
|
.'max('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_max,'
|
||||||
|
.'min('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_min,'
|
||||||
|
.'variance('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_var'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
39
dbd/qq/SYS_SAIMOD_LOG_BASIC_SUCCESS.php
Normal file
39
dbd/qq/SYS_SAIMOD_LOG_BASIC_SUCCESS.php
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_BASIC_SUCCESS extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.') as http_referer_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.') as http_user_agent_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
||||||
|
.'then 1 else 0 end) class_fail,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
||||||
|
.'then 1 else 0 end) class_log,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
27
dbd/qq/SYS_SAIMOD_LOG_BASIC_VISITOR.php
Normal file
27
dbd/qq/SYS_SAIMOD_LOG_BASIC_VISITOR.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_BASIC_VISITOR extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_FILE.') as file_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_LINE.') as line_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_CLASS.') as class_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
32
dbd/qq/SYS_SAIMOD_LOG_CLASS_BASIC.php
Normal file
32
dbd/qq/SYS_SAIMOD_LOG_CLASS_BASIC.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_CLASS_BASIC extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ERROR\' then 1 else 0 end) class_ERROR,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WARNING\' then 1 else 0 end) class_WARNING,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' then 1 else 0 end) class_INFO,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' then 1 else 0 end) class_DEPRECATED,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'AppError\' then 1 else 0 end) class_AppError'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ERROR\' then 1 else 0 end) class_ERROR,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WARNING\' then 1 else 0 end) class_WARNING,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' then 1 else 0 end) class_INFO,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' then 1 else 0 end) class_DEPRECATED,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'AppError\' then 1 else 0 end) class_AppError'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
28
dbd/qq/SYS_SAIMOD_LOG_CLASS_OTHER.php
Normal file
28
dbd/qq/SYS_SAIMOD_LOG_CLASS_OTHER.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_CLASS_OTHER extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'Exception\' then 1 else 0 end) class_Exception,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'RuntimeException\' then 1 else 0 end) class_RuntimeException,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ErrorException\' then 1 else 0 end) class_ErrorException'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'Exception\' then 1 else 0 end) class_Exception,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'RuntimeException\' then 1 else 0 end) class_RuntimeException,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ErrorException\' then 1 else 0 end) class_ErrorException'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
36
dbd/qq/SYS_SAIMOD_LOG_CLASS_SYSTEM.php
Normal file
36
dbd/qq/SYS_SAIMOD_LOG_CLASS_SYSTEM.php
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_CLASS_SYSTEM extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_SYSTEM_LOG_COUNTER,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' then 1 else 0 end) class_SYSTEM_LOG_INFO,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' then 1 else 0 end) class_SYSTEM_LOG_DEPRECATED,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\WARNING\' then 1 else 0 end) class_SYSTEM_LOG_WARNING,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR\' then 1 else 0 end) class_SYSTEM_LOG_ERROR,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_ERROR_EXCEPTION,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\SHUTDOWN_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_SHUTDOWN_EXCEPTION'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_SYSTEM_LOG_COUNTER,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' then 1 else 0 end) class_SYSTEM_LOG_INFO,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' then 1 else 0 end) class_SYSTEM_LOG_DEPRECATED,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\WARNING\' then 1 else 0 end) class_SYSTEM_LOG_WARNING,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR\' then 1 else 0 end) class_SYSTEM_LOG_ERROR,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_ERROR_EXCEPTION,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\SHUTDOWN_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_SHUTDOWN_EXCEPTION'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
20
dbd/qq/SYS_SAIMOD_LOG_ERROR.php
Normal file
20
dbd/qq/SYS_SAIMOD_LOG_ERROR.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_ERROR extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
||||||
|
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_PG.
|
||||||
|
' ON '.\SYSTEM\DBD\system_log::NAME_PG.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
||||||
|
' = '.\SYSTEM\DBD\system_user::NAME_PG.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::NAME_PG.'."'.\SYSTEM\DBD\system_log::FIELD_ID.'" = $1;',
|
||||||
|
//mys
|
||||||
|
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
||||||
|
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.
|
||||||
|
' ON '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
||||||
|
' = '.\SYSTEM\DBD\system_user::NAME_MYS.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_ID.' = ?;'
|
||||||
|
);}}
|
||||||
|
|
||||||
22
dbd/qq/SYS_SAIMOD_LOG_FILTER.php
Normal file
22
dbd/qq/SYS_SAIMOD_LOG_FILTER.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_FILTER extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
||||||
|
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_PG.
|
||||||
|
' ON '.\SYSTEM\DBD\system_log::NAME_PG.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
||||||
|
' = '.\SYSTEM\DBD\system_user::NAME_PG.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE $1'.
|
||||||
|
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.' DESC LIMIT 100;',
|
||||||
|
//mys
|
||||||
|
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
||||||
|
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.
|
||||||
|
' ON '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
||||||
|
' = '.\SYSTEM\DBD\system_user::NAME_MYS.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE ?'.
|
||||||
|
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.' DESC LIMIT 100;'
|
||||||
|
);}}
|
||||||
|
|
||||||
18
dbd/qq/SYS_SAIMOD_LOG_FILTERS.php
Normal file
18
dbd/qq/SYS_SAIMOD_LOG_FILTERS.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_FILTERS extends \SYSTEM\DB\QQ {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
||||||
|
' GROUP BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.';',
|
||||||
|
//mys
|
||||||
|
'SELECT '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
||||||
|
' GROUP BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.';'
|
||||||
|
);}}
|
||||||
|
|
||||||
17
dbd/qq/SYS_SAIMOD_LOG_FILTER_COUNT.php
Normal file
17
dbd/qq/SYS_SAIMOD_LOG_FILTER_COUNT.php
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_FILTER_COUNT extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT COUNT(*) as count FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' LIKE $1;',
|
||||||
|
//mys
|
||||||
|
'SELECT COUNT(*) as count'.
|
||||||
|
' FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
||||||
|
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
||||||
|
' LIKE ?;'
|
||||||
|
);}}
|
||||||
|
|
||||||
12
dbd/qq/SYS_SAIMOD_LOG_TRUNCATE.php
Normal file
12
dbd/qq/SYS_SAIMOD_LOG_TRUNCATE.php
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_TRUNCATE extends \SYSTEM\DB\QQ {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'TRUNCATE '.\SYSTEM\DBD\system_log::NAME_PG.';',
|
||||||
|
//mys
|
||||||
|
'TRUNCATE '.\SYSTEM\DBD\system_log::NAME_MYS.';'
|
||||||
|
);}}
|
||||||
|
|
||||||
40
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_BASIC.php
Normal file
40
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_BASIC.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_UNIQUE_BASIC extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'sum(case when not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' and '
|
||||||
|
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
||||||
|
.'then 1 else 0 end) class_fail,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' or '
|
||||||
|
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
||||||
|
.'then 1 else 0 end) class_log,'
|
||||||
|
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
28
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_EXCEPTION.php
Normal file
28
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_EXCEPTION.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_UNIQUE_EXCEPTION extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_FILE.') as file_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_LINE.') as line_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_CLASS.') as class_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
30
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_REFERER.php
Normal file
30
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_REFERER.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_UNIQUE_REFERER extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.') as http_referer_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.') as http_user_agent_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
30
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_REQUEST.php
Normal file
30
dbd/qq/SYS_SAIMOD_LOG_UNIQUE_REQUEST.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
namespace SYSTEM\DBD;
|
||||||
|
|
||||||
|
class SYS_SAIMOD_LOG_UNIQUE_REQUEST extends \SYSTEM\DB\QP {
|
||||||
|
protected static function query(){
|
||||||
|
return new \SYSTEM\DB\QQuery(get_class(),
|
||||||
|
//pg
|
||||||
|
'SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % $1)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;',
|
||||||
|
//mys
|
||||||
|
'SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),?)) as day,'
|
||||||
|
.'count(*) as count,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
||||||
|
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
||||||
|
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
||||||
|
.' GROUP BY day'
|
||||||
|
.' ORDER BY day DESC'
|
||||||
|
.' LIMIT 30;'
|
||||||
|
);}}
|
||||||
|
|
||||||
@ -4,444 +4,67 @@ namespace SYSTEM\SAI;
|
|||||||
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_truncate(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_truncate(){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
\SYSTEM\DBD\SYS_SAIMOD_LOG_TRUNCATE::QQ();
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::ok();}
|
||||||
$con->query('TRUNCATE '.\SYSTEM\DBD\system_log::NAME_PG.';');
|
|
||||||
} else {
|
|
||||||
$con->query('TRUNCATE '.\SYSTEM\DBD\system_log::NAME_MYS.';');}
|
|
||||||
return \SYSTEM\LOG\JsonResult::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats(){
|
||||||
$vars = array();
|
$vars = array();
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_stats.tpl'), $vars);
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_stats.tpl'), $vars);}
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_admin(){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_admin(){
|
||||||
$vars = array();
|
$vars = array();
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_admin.tpl'), $vars);
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_admin.tpl'), $vars);}
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_system($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_system($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_CLASS_SYSTEM::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_SYSTEM_LOG_COUNTER,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' then 1 else 0 end) class_SYSTEM_LOG_INFO,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' then 1 else 0 end) class_SYSTEM_LOG_DEPRECATED,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\WARNING\' then 1 else 0 end) class_SYSTEM_LOG_WARNING,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR\' then 1 else 0 end) class_SYSTEM_LOG_ERROR,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_ERROR_EXCEPTION,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\SHUTDOWN_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_SHUTDOWN_EXCEPTION'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_SYSTEM_LOG_COUNTER,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' then 1 else 0 end) class_SYSTEM_LOG_INFO,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' then 1 else 0 end) class_SYSTEM_LOG_DEPRECATED,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\WARNING\' then 1 else 0 end) class_SYSTEM_LOG_WARNING,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR\' then 1 else 0 end) class_SYSTEM_LOG_ERROR,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\ERROR_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_ERROR_EXCEPTION,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\SHUTDOWN_EXCEPTION\' then 1 else 0 end) class_SYSTEM_LOG_SHUTDOWN_EXCEPTION'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_other($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_other($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_CLASS_OTHER::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'Exception\' then 1 else 0 end) class_Exception,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'RuntimeException\' then 1 else 0 end) class_RuntimeException,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ErrorException\' then 1 else 0 end) class_ErrorException'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'Exception\' then 1 else 0 end) class_Exception,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'RuntimeException\' then 1 else 0 end) class_RuntimeException,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ErrorException\' then 1 else 0 end) class_ErrorException'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_basic($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_class_basic($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_CLASS_BASIC::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ERROR\' then 1 else 0 end) class_ERROR,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WARNING\' then 1 else 0 end) class_WARNING,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' then 1 else 0 end) class_INFO,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' then 1 else 0 end) class_DEPRECATED,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'AppError\' then 1 else 0 end) class_AppError'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'ERROR\' then 1 else 0 end) class_ERROR,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'WARNING\' then 1 else 0 end) class_WARNING,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' then 1 else 0 end) class_INFO,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' then 1 else 0 end) class_DEPRECATED,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'AppError\' then 1 else 0 end) class_AppError'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_basic($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_basic($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_UNIQUE_BASIC::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' and '
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
|
||||||
.'then 1 else 0 end) class_fail,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'DEPRECATED\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'PreprocessingLog\' '
|
|
||||||
.'then 1 else 0 end) class_log,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_request($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_request($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_UNIQUE_REQUEST::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_exception($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_exception($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_UNIQUE_EXCEPTION::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_FILE.') as file_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_LINE.') as line_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_CLASS.') as class_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_referer($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_unique_referer($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_UNIQUE_REFERER::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_NAME.') as server_name_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_SERVER_PORT.') as server_port_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_REQUEST_URI.') as request_uri_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_POST.') as post_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.') as http_referer_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.') as http_user_agent_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_visitor($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_visitor($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_BASIC_VISITOR::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_FILE.') as file_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_LINE.') as line_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_CLASS.') as class_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_sucess($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_sucess($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_BASIC_SUCCESS::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_REFERER.') as http_referer_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_HTTP_USER_AGENT.') as http_user_agent_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'sum(case when not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' and'
|
|
||||||
.' not '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
|
||||||
.'then 1 else 0 end) class_fail,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'INFO\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\DEPRECATED\' or '
|
|
||||||
.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'EPRECATED\' '
|
|
||||||
.'then 1 else 0 end) class_log,'
|
|
||||||
.'sum(case when '.\SYSTEM\DBD\system_log::FIELD_CLASS.' = \'SYSTEM\LOG\COUNTER\' then 1 else 0 end) class_sucess'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_querytime($filter){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_stats_name_basic_querytime($filter){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$result = \SYSTEM\DBD\SYS_SAIMOD_LOG_BASIC_QUERYTIME::QA(array($filter));
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
return \SYSTEM\LOG\JsonResult::toString($result);}
|
||||||
$res = $con->query('SELECT to_timestamp(extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int - (extract(epoch from '.\SYSTEM\DBD\system_log::FIELD_TIME.')::int % '.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'count(distinct "'.\SYSTEM\DBD\system_log::FIELD_USER.'") as user_unique,'
|
|
||||||
.'count(distinct '.\SYSTEM\DBD\system_log::FIELD_IP.') as ip_unique'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_PG
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT FROM_UNIXTIME(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.') - MOD(UNIX_TIMESTAMP('.\SYSTEM\DBD\system_log::FIELD_TIME.'),'.$filter.')) as day,'
|
|
||||||
.'count(*) as count,'
|
|
||||||
.'avg('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_avg,'
|
|
||||||
.'max('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_max,'
|
|
||||||
.'min('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_min,'
|
|
||||||
.'variance('.\SYSTEM\DBD\system_log::FIELD_QUERYTIME.') as querytime_var'
|
|
||||||
.' FROM '.\SYSTEM\DBD\system_log::NAME_MYS
|
|
||||||
.' GROUP BY day'
|
|
||||||
.' ORDER BY day DESC'
|
|
||||||
.' LIMIT 30;');
|
|
||||||
}
|
|
||||||
$result = array();
|
|
||||||
while($row = $res->next()){
|
|
||||||
$result[] = $row;}
|
|
||||||
|
|
||||||
return \SYSTEM\LOG\JsonResult::toString($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_error($error){
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_error($error){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$vars = \SYSTEM\DBD\SYS_SAIMOD_LOG_ERROR::QQ(array($error))->next();
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->prepare( 'selectSysLogError',
|
|
||||||
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_PG.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_PG.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_PG.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' WHERE '.\SYSTEM\DBD\system_log::NAME_PG.'."'.\SYSTEM\DBD\system_log::FIELD_ID.'" = $1;',
|
|
||||||
array($error));
|
|
||||||
} else {
|
|
||||||
$res = $con->prepare( 'selectSysLogError',
|
|
||||||
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_MYS.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' WHERE '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_ID.' = ?;',
|
|
||||||
array($error));
|
|
||||||
}
|
|
||||||
|
|
||||||
$vars = $res->next();
|
|
||||||
$vars['trace'] = implode('</br>', array_slice(explode('#', $vars['trace']), 1, -1));
|
$vars['trace'] = implode('</br>', array_slice(explode('#', $vars['trace']), 1, -1));
|
||||||
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_error.tpl'), $vars);
|
return \SYSTEM\PAGE\replace::replaceFile(\SYSTEM\SERVERPATH(new \SYSTEM\PSAI(),'modules/saimod_sys_log/saimod_sys_log_error.tpl'), $vars);}
|
||||||
}
|
|
||||||
|
|
||||||
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter($filter = ""){
|
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
|
||||||
$res = null;
|
|
||||||
if($filter !== ""){
|
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->prepare( 'selectCountSysLogFilter',
|
|
||||||
'SELECT COUNT(*) as count FROM '.\SYSTEM\DBD\system_log::NAME_PG.' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE $1;',
|
|
||||||
array($filter))->next();
|
|
||||||
$count = $res['count'];
|
|
||||||
$res = $con->prepare( 'selectSysLogFilter',
|
|
||||||
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_PG.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_PG.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_PG.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE $1'.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.' DESC LIMIT 100;',
|
|
||||||
array($filter));
|
|
||||||
} else {
|
|
||||||
$res = $con->prepare( 'selectCountSysLogFilter',
|
|
||||||
'SELECT COUNT(*) as count'.
|
|
||||||
' FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
|
||||||
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE ?;',
|
|
||||||
array(mysql_escape_string($filter)))->next();
|
|
||||||
$count = $res['count'];
|
|
||||||
$res = $con->prepare( 'selectSysLogFilter',
|
|
||||||
'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_MYS.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' WHERE '.\SYSTEM\DBD\system_log::FIELD_CLASS.' LIKE ?'.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.' DESC LIMIT 100;',
|
|
||||||
array(mysql_escape_string($filter)));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->query('SELECT COUNT(*) as count FROM '.\SYSTEM\DBD\system_log::NAME_PG)->next();
|
|
||||||
$count = $res['count'];
|
|
||||||
$res = $con->query( 'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_PG.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_PG.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_PG.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.
|
|
||||||
' DESC LIMIT 100;');
|
|
||||||
} else {
|
|
||||||
$res = $con->query('SELECT COUNT(*) as count FROM '.\SYSTEM\DBD\system_log::NAME_MYS)->next();
|
|
||||||
$count = $res['count'];
|
|
||||||
$res = $con->query( 'SELECT * FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
|
||||||
' LEFT JOIN '.\SYSTEM\DBD\system_user::NAME_MYS.
|
|
||||||
' ON '.\SYSTEM\DBD\system_log::NAME_MYS.'.'.\SYSTEM\DBD\system_log::FIELD_USER.
|
|
||||||
' = '.\SYSTEM\DBD\system_user::NAME_MYS.'.'.\SYSTEM\DBD\system_user::FIELD_ID.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_TIME.
|
|
||||||
' DESC LIMIT 100;');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static function sai_mod__SYSTEM_SAI_saimod_sys_log_action_filter($filter = "%"){
|
||||||
|
$res = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTER_COUNT::QQ(array(mysql_escape_string($filter)))->next();
|
||||||
|
$count = $res['count'];
|
||||||
|
$res = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTER::QQ(array(mysql_escape_string($filter)));
|
||||||
$now = microtime(true);
|
$now = microtime(true);
|
||||||
|
|
||||||
$table='';
|
$table='';
|
||||||
while($r = $res->next()){
|
while($r = $res->next()){
|
||||||
//print_r($r);
|
//print_r($r);
|
||||||
@ -484,19 +107,7 @@ class saimod_sys_log extends \SYSTEM\SAI\SaiModule {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static function generate_error_filters(){
|
private static function generate_error_filters(){
|
||||||
$con = new \SYSTEM\DB\Connection(\SYSTEM\system::getSystemDBInfo());
|
$res = \SYSTEM\DBD\SYS_SAIMOD_LOG_FILTERS::QQ();
|
||||||
if(\SYSTEM\system::isSystemDbInfoPG()){
|
|
||||||
$res = $con->query( 'SELECT '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
|
||||||
' FROM '.\SYSTEM\DBD\system_log::NAME_PG.
|
|
||||||
' GROUP BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.';');
|
|
||||||
}else{
|
|
||||||
$res = $con->query( 'SELECT '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
|
||||||
' FROM '.\SYSTEM\DBD\system_log::NAME_MYS.
|
|
||||||
' GROUP BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.
|
|
||||||
' ORDER BY '.\SYSTEM\DBD\system_log::FIELD_CLASS.';');
|
|
||||||
}
|
|
||||||
|
|
||||||
$result = '';
|
$result = '';
|
||||||
while($row = $res->next()){
|
while($row = $res->next()){
|
||||||
$result .= '<li><a href="#" filter="'.$row['class'].'">'.$row['class'].'</a></li>';}
|
$result .= '<li><a href="#" filter="'.$row['class'].'">'.$row['class'].'</a></li>';}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<ul class="nav nav-pills" id="error_filter">
|
<ul class="nav nav-pills" id="error_filter">
|
||||||
<li class="active"><a href="#" filter="">All</a></li>
|
<li class="active"><a href="#" filter="%">All</a></li>
|
||||||
${error_filter}
|
${error_filter}
|
||||||
<button id="refresh_error_table" class="btn" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;">Refresh</button>
|
<button id="refresh_error_table" class="btn" style="margin-right: 15px; height: 32px; font-size: 13px; float: right;">Refresh</button>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user