doclassif/elastic

Laravel Elastic custom formatter

2.1.1 2024-05-03 12:35 UTC

This package is auto-updated.

Last update: 2024-11-03 13:35:22 UTC


README

Latest Stable Version

Запуск в dev container VScode

  1. Open project
  2. F1 -> Dev Containers: Rebuild and Reopen in Container

Запуск тестов (которые будут в обозримом будущем)

composer test
  1. Добавить конфигурацию в 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
  1. Выполнить php artisan vendor:publish и выбрать Elastic\Providers\ElasticServiceProvider