PHP code example of james-ban / yii2-logstash

1. Go to this page and download the library: Download james-ban/yii2-logstash library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

james-ban / yii2-logstash example snippets


  
    ....
     'log' => [
              'traceLevel' => YII_DEBUG ? 3 : 0,
              'targets' => [
                  ....
                  [
                      'class' => 'Log\LogstashFileTarget',
                      'levels' => ['error', 'warning'],
                      'except' => ['yii\web\HttpException:404', 'yii\web\HttpException:403', 'yii\debug\Module::checkAccess',  'yii\web\HttpException:400', 'yii\base\UserException', 'yii\web\HttpException:401'],
                      'logFile' => '@runtime/logs/logstash.log',
                  ]
                ....
              ],
          ],
  .....