cakephpsyslogcakephp-2.1

is there any way to make syslog in one row from json-format?


I am new in logs. Is there any way to make syslog in one row? It has json-format in info.log, but I need to make it more readable in syslog (for google cloud logging). I use cakephp v2.1.
How it looks now:

[SYSLOG] : info: Array
[SYSLOG] : info: (
[SYSLOG] : info:     [Message] => Array
[SYSLOG] : info:         (
[SYSLOG] : info:             [user_id] => 1321
[SYSLOG] : info:             [ip] => 172.10.1.1
[SYSLOG] : info:             [user_agent] => Mozilla/5.0 (Macintosh.... etc) 
[SYSLOG] : info:         )
[SYSLOG] : info: 
[SYSLOG] : info: )

This is config from bootstrap.php

CakeLog::config('default', [
    'engine' => 'SyslogLog',
    'types' => array('info', 'error', 'warning'),
]);

How I want to see it

[SYSLOG] : info: Array([Message] => Array([user_id] => 1321[ip] => 172.10.1.1[user_agent] => Mozilla/5.0 (Macintosh.... etc)))

Maybe are there some tools in Google Cloud Logging to solve it? Thanks


Solution

  • I fixed it just changing function that send it.

    How it was:

    $this->log($log, 'info');
    

    How I changed:

    $this->log(json_encode($log), 'info');
    

    P.S. sometimes simple is the best solution