Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airani/yii2-elasticsearch-log
Yii 2.0 Elasticsearch log target
https://github.com/airani/yii2-elasticsearch-log
elasticsearch log logger yii-extension yii2
Last synced: about 7 hours ago
JSON representation
Yii 2.0 Elasticsearch log target
- Host: GitHub
- URL: https://github.com/airani/yii2-elasticsearch-log
- Owner: airani
- License: bsd-3-clause
- Created: 2017-10-13T22:07:41.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-14T22:14:26.000Z (about 7 years ago)
- Last Synced: 2024-10-06T15:12:35.928Z (about 1 month ago)
- Topics: elasticsearch, log, logger, yii-extension, yii2
- Language: PHP
- Size: 3.91 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Yii 2.0 Elasticsearch log target
================================Installation
------------The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
php composer.phar require -vv --prefer-dist airani/yii2-elasticsearch-log
```or add below line to the composer.json and run `php composer.phar update -vv --prefer-dist --profile`
```
"airani/yii2-elasticsearch-log": "~1.0"
```Usage
-----
Config elasticsearch log target in config file like below code. with set `extraFields` property in log target config you can set more extra fields to log results.```php
'components' => [
// ...
'log' => [
'targets' => [
[
'class' => 'airani\log\ElasticsearchTarget',
'levels' => ['error', 'warning'],
'index' => 'yii',
'type' => 'log',
'db' => 'elasticsearch',
'extraFields' => [
'ip' => function ($app) {
return $app->request->getUserIP();
}
]
],
],
],
],
```