doclassif / elastic
Laravel Elastic custom formatter
2.1.1
2024-05-03 12:35 UTC
Requires
- elasticsearch/elasticsearch: ^8.7
- monolog/monolog: ^3.0
Requires (Dev)
- orchestra/testbench: ^8.3
- phpunit/phpunit: *
README
Запуск в dev container VScode
- Open project
- F1 -> Dev Containers: Rebuild and Reopen in Container
Запуск тестов (которые будут в обозримом будущем)
composer test
- Добавить конфигурацию в
config/logging.php
(актуальная конфигурация в документации пакета)
'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['stdout', 'daily', 'elasticsearch'], 'ignore_exceptions' => false, ], 'elasticsearch' => [ 'driver' => 'monolog', 'level' => 'debug', 'handler' => Kali\Elastic\ElasticsearchHandler::class, 'formatter' => Kali\Elastic\ElasticsearchFormatter::class, 'formatter_with' => [ 'index' => env('ELASTIC_LOGS_INDEX'), 'type' => '_doc', ], 'handler_with' => [ 'hosts' => [env('ELASTIC_HOST', "http://elasticsearch:9200/")], 'options' => [ 'ignore_error' => env('ELASTIC_IGNORE_ERROR', true), ] ], ], ],
.env переменные
ELASTIC_HOST=elasticsearch:9200
ELASTIC_LOGS_INDEX=test_logs
- Выполнить
php artisan vendor:publish
и выбратьElastic\Providers\ElasticServiceProvider