hedii / laravel-gelf-logger

A package to send gelf logs to a gelf compatible backend like graylog
MIT License
125 stars 33 forks source link

Stuck for 8s if the remote service is unavailable #46

Closed Webinx closed 1 year ago

Webinx commented 1 year ago

Hello, is there a built-in way to handle async requests or set a custom timeout? Currently, when the remote service is unavailable, my app gets stuck for 8 seconds for each log request.

hedii commented 1 year ago

Hi, what you want is to use udp transport (check the readme)

Webinx commented 1 year ago

Yes, I am already using it. In fact, I am using the exact same configuration as in the readme.

hedii commented 1 year ago

It is not possible that your app is getting stuck with udp transport. Please share your full logging config

Webinx commented 1 year ago
        'gelf' => [
            'driver' => 'custom',
            'via'    => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,
            'processors' => [
                \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
                \Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor::class,
            ],
            'level' => 'debug',
            'transport' => 'udp',
            'system_name' => null,
            'host' => 'logger',
            'port' => '12201',
            'chunk_size' => 1420,
            'path' => null,
            'ssl' => false,
            'ssl_options' => [
                'verify_peer' => true,
                'ca_file' => null,
                'ciphers' => null,
                'allow_self_signed' => false,
            ],
            'max_length' => null,
            'context_prefix' => null,
            'extra_prefix' => null,
            'ignore_error' => true,
        ],

then I use

\Log::channel('gelf')->error('test123');

Everything else in logging.php is the default. Laravel 10, package version 8.1.0, PHP 8.2

Webinx commented 1 year ago

After some more tests I've found where the issue is

'host' => 'localhost' // works
'host' => '127.0.0.1' // works
'host' => '172.29.0.4' // works
'host' => 'mycustomhost' // stuck 8s