php-mongo-session
php-mongo-session copied to clipboard
update logging output to be parseable/consistent
@nicktacular do you have any objections to modifying the basic logging output to be delmiter-based -- or structured consistently in some way so it's parse-able?
I'd like to import my session logging into my logstash server so I can monitor average lock wait times, expired lock waits, etc via my ELK stack (elasticsearch+logstash+kibana).
But I cannot control the output entirely via the current 'logger' configuration. It would be best if the ->log() function were to pass raw name/value pairs for example so I can handle them properly from mongo_logger() (my function).
I guess I could just explode(':', $msg) on the message that is coming in, but even that won't work consistently because some of the log messages are just random strings.
I am thinking basically we break $msg apart into two inputs.
So you would have something like;
$this->log('lock_wait_exceeded','.3502s');
Instead of:
$this->log('LOCK_WAIT_EXCEEDED:.3502s');
Maybe the generic messages like 'Lock acquired @ ...' would simply be given an action of 'message' or something like that.
Again something like,
$this->log('message','Lock acquired @ xxxx');
Instead of
$this->log('Lock acquired @ xxxx');
This way your logger function can actually handle the parameters separately.
Perhaps we might need to add a way for it to be backwards compatible, so maybe add them as optional params.
IE,
function log($msg, $priority=10, $opts=array()){
Sure thing. But I'd like to merge my testing branch into master first. On Mar 4, 2015 10:51 PM, "Kyle Renfrow" [email protected] wrote:
@nicktacular https://github.com/nicktacular do you have any objections to modifying the basic logging output to be delmiter-based -- or structured consistently in some way so it's parse-able?
I'd like to import my session logging into my logstash server so I can monitor average lock wait times, expired lock waits, etc via my ELK stack (elasticsearch+logstash+kibana).
But I cannot control the output entirely via the current 'logger' configuration. It would be best if the ->log() function were to pass raw name/value pairs for example so I can handle them properly from mongo_logger() (my function).
I guess I could just explode(':', $msg) on the message that is coming in, but even that won't work consistently because some of the log messages are just random strings.
I am thinking basically we break $msg apart into two inputs.
So you would have something like;
$this->log('lock_wait_exceeded','.3502s');
Instead of:
$this->log('LOCK_WAIT_EXCEEDED:.3502s');
Maybe the generic messages like 'Lock acquired @ ...' would simply be given an action of 'message' or something like that.
Again something like,
$this->log('message','Lock acquired @ xxxx');
Instead of
$this->log('Lock acquired @ xxxx');
This way your logger function can actually handle the parameters separately.
Perhaps we might need to add a way for it to be backwards compatible, so maybe add them as optional params.
IE,
function log($msg, $priority=10, $opts=array()){
— Reply to this email directly or view it on GitHub https://github.com/nicktacular/php-mongo-session/issues/21.