2017 © Pedro Peláez
 

library yii2-jsonsyslog

Yii2 log target for sending data to Syslog as a JSON encoded string

image

silinternational/yii2-jsonsyslog

Yii2 log target for sending data to Syslog as a JSON encoded string

  • Wednesday, August 19, 2015
  • by fillup
  • Repository
  • 5 Watchers
  • 1 Stars
  • 3,615 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

Yii2-JsonSyslog

Yii2 log target for sending data to Syslog as a JSON encoded string, useful services such as Logentries., (*1)

Tips

Only send the JSON content

Make sure that the template you define for Logentries in your rsyslog.conf file does not add other content before the %msg% data (aside from your Logentries key). For example, do something like this..., (*2)

$template Logentries,"LOGENTRIESKEY %msg%\n"

... NOT like this..., (*3)

$template Logentries,"LOGENTRIESKEY %HOSTNAME% %syslogtag%%msg%\n"

Have the log prefix (if used) return JSON

Example (to be placed into your Yii2 config file's ['components']['log']['targets'] array):, (*4)

[
    'class' => 'sil\log\JsonSyslogTarget',
    'levels' => ['error', 'warning'],
    'except' => [
        'yii\web\HttpException:401',
        'yii\web\HttpException:404',
    ],
    'logVars' => [], // Disable logging of _SERVER, _POST, etc.
    'prefix' => function($message) use ($APP_ENV) {
        $prefixData = array(
            'env' => $APP_ENV,
        );
        if (! \Yii::$app->user->isGuest) {
            $prefixData['user'] = \Yii::$app->user->identity->email;
        }
        return \yii\helpers\Json::encode($prefixData);
    },
],

License

This is released under the MIT license (see LICENSE file)., (*5)

The Versions

19/08 2015

dev-develop

dev-develop

Yii2 log target for sending data to Syslog as a JSON encoded string

  Sources   Download

MIT

The Requires

 

log json yii2 syslog

19/08 2015

dev-master

9999999-dev

Yii2 log target for sending data to Syslog as a JSON encoded string

  Sources   Download

MIT

The Requires

 

log json yii2 syslog

19/08 2015

1.0.0

1.0.0.0

Yii2 log target for sending data to Syslog as a JSON encoded string

  Sources   Download

MIT

The Requires

 

log json yii2 syslog