mirror of https://github.com/MISP/MISP
fix: [internal] Access log errors from test
parent
4a3f0990ad
commit
fb43e1e6a9
|
@ -71,12 +71,6 @@ class AccessLog extends AppModel
|
||||||
{
|
{
|
||||||
$accessLog = &$this->data['AccessLog'];
|
$accessLog = &$this->data['AccessLog'];
|
||||||
|
|
||||||
$this->externalLog($accessLog);
|
|
||||||
|
|
||||||
if (Configure::read('MISP.log_paranoid_skip_db')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Truncate
|
// Truncate
|
||||||
foreach (['request_id', 'user_agent', 'url'] as $field) {
|
foreach (['request_id', 'user_agent', 'url'] as $field) {
|
||||||
if (isset($accessLog[$field]) && strlen($accessLog[$field]) > 255) {
|
if (isset($accessLog[$field]) && strlen($accessLog[$field]) > 255) {
|
||||||
|
@ -214,6 +208,12 @@ class AccessLog extends AppModel
|
||||||
$data['query_count'] = $queryCount;
|
$data['query_count'] = $queryCount;
|
||||||
$data['duration'] = (int)((microtime(true) - $requestTime->format('U.u')) * 1000); // in milliseconds
|
$data['duration'] = (int)((microtime(true) - $requestTime->format('U.u')) * 1000); // in milliseconds
|
||||||
|
|
||||||
|
$this->externalLog($data);
|
||||||
|
|
||||||
|
if (Configure::read('MISP.log_paranoid_skip_db')) {
|
||||||
|
return true; // do not save access log to database
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return $this->save($data, ['atomic' => false]);
|
return $this->save($data, ['atomic' => false]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
@ -226,7 +226,7 @@ class AccessLog extends AppModel
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function externalLog(array $data)
|
private function externalLog(array $data)
|
||||||
{
|
{
|
||||||
if ($this->pubToZmq('audit')) {
|
if ($this->pubToZmq('audit')) {
|
||||||
$this->getPubSubTool()->publish($data, 'audit', 'log');
|
$this->getPubSubTool()->publish($data, 'audit', 'log');
|
||||||
|
|
Loading…
Reference in New Issue