macfly/yii2-stream-log

This package is abandoned and no longer maintained. No replacement package was suggested.

Yii2 module, provide a cli to send log to elasticsearch asynchronously use redis as a local buffer

Installs: 16 275

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Type:yii2-extension

0.1.7 2021-01-06 04:53 UTC

This package is auto-updated.

Last update: 2023-04-13 03:40:37 UTC


README

Yii2 module, provide a cli to send log to elasticsearch asynchronously use redis as a local buffer

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist "macfly/yii2-stream-log" "*"

or add

"macfly/yii2-stream-log": "*"

to the require section of your composer.json file.

Configure

Configure config/console.php and config/web.php as follows

  'bootstrap' => [
      'log',
      'streamlog',
  ],
  'modules' => [
     ................
     'streamlog' => [
         'class' => 'macfly\streamlog\Module',
         'redisTarget' => [
             'exportInterval' => 1,
             'logVars'        => [],
             'logUser'        => true,
             'logApp'         => true,
             'logTracker'     => true,
             'logUserIp'      => true,
             'logSession'     => true,
             'userNameAt'     => 'username',
         ],
         'elasticsearchTarget' => [
            'indexDateFormat' => 'y-MM-dd', // Set date to append to index, will be yii-2018-10-24
        ],
    ],
    ................
  ],

Usage

Run the following to enable log streaming from redis to elasticsearch

php yii streamlog/sender/start