Git Product home page Git Product logo

laravel-gelf-logger's Introduction

Laravel Gelf Logger

Build Status Total Downloads License Latest Stable Version

Laravel laravel-gelf-logger
5.6 ^3.0
5.8 ^3.1
6.0 ^4.0
7.0 ^5.0
8.0 ^5.3
8.0 ^6.0 (with php 8)
9.0 ^7.0
10.0 ^8.0
11.0 ^9.0

A package to send gelf logs to a gelf compatible backend like graylog. It is a Laravel wrapper for bzikarsky/gelf-php package.

It uses the new Laravel custom log channel introduced in Laravel 5.6.

A gelf receiver like graylog2 must be configured to receive messages with a GELF UDP, TCP or HTTP Input.

Table of contents

Installation

Install via composer

composer require hedii/laravel-gelf-logger

Edit config/logging.php to add the new gelf log channel.

return [
    'default' => env('LOG_CHANNEL', 'stack'),

    'channels' => [
        // You can use the gelf log channel with the stack log channel
        'stack' => [
            'driver' => 'stack',
            'channels' => ['daily', 'gelf'],
        ],

        // other log channels...

        'gelf' => [
            'driver' => 'custom',

            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,

            // This optional option determines the processors that should be
            // pushed to the handler. This option is useful to modify a field
            // in the log context (see NullStringProcessor), or to add extra
            // data. Each processor must be a callable or an object with an
            // __invoke method: see monolog documentation about processors.
            // Default is an empty array.
            'processors' => [
                \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
                \Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor::class,
                // another processor...
            ],

            // This optional option determines the minimum "level" a message
            // must be in order to be logged by the channel. Default is 'debug'
            'level' => 'debug',

            // This optional option determines the channel name sent with the
            // message in the 'facility' field. Default is equal to app.env
            // configuration value
            'name' => 'my-custom-name',

            // This optional option determines the system name sent with the
            // message in the 'source' field. When forgotten or set to null,
            // the current hostname is used.
            'system_name' => null,

            // This optional option determines if you want the UDP, TCP or HTTP
            // transport for the gelf log messages. Default is UDP
            'transport' => 'udp',

            // This optional option determines the host that will receive the
            // gelf log messages. Default is 127.0.0.1
            'host' => '127.0.0.1',

            // This optional option determines the port on which the gelf
            // receiver host is listening. Default is 12201
            'port' => 12201,
            
            // This optional option determines the chunk size used when
            // transferring message via UDP transport. Default is 1420.
            'chunk_size' => 1420,

            // This optional option determines the path used for the HTTP
            // transport. When forgotten or set to null, default path '/gelf'
            // is used.
            'path' => null,
            
            // This optional option enable or disable ssl on TCP or HTTP
            // transports. Default is false.
            'ssl' => false,
            
            // If ssl is enabled, the following configuration is used.
            'ssl_options' => [
                // Enable or disable the peer certificate check. Default is
                // true.
                'verify_peer' => true,
                
                // Path to a custom CA file (eg: "/path/to/ca.pem"). Default
                // is null.
                'ca_file' => null,
                
                // List of ciphers the SSL layer may use, formatted as
                // specified in ciphers(1). Default is null.
                'ciphers' => null,
                
                // Whether self-signed certificates are allowed. Default is
                // false.
                'allow_self_signed' => false,
            ],

            // This optional option determines the maximum length per message
            // field. When forgotten or set to null, the default value of 
            // \Monolog\Formatter\GelfMessageFormatter::DEFAULT_MAX_LENGTH is
            // used (currently this value is 32766)
            'max_length' => null,

            // This optional option determines the prefix for 'context' fields
            // from the Monolog record. Default is null (no context prefix)
            'context_prefix' => null,

            // This optional option determines the prefix for 'extra' fields
            // from the Monolog record. Default is null (no extra prefix)
            'extra_prefix' => null,
            
            // This optional option determines whether errors thrown during
            // logging should be ignored or not. Default is true.
            'ignore_error' => true,

        ],
    ],
];

Usage

Once you have modified the Laravel logging configuration, you can use the gelf log channel as any Laravel log channel.

Example

// Explicitly use the gelf channel
Log::channel('gelf')->debug($message, ['foo' => 'bar']);
Log::channel('gelf')->emergency($message, ['foo' => 'bar']);

// In case of a stack log channel containing the gelf log channel and stack
// configured as the default log channel
Log::notice($message, ['foo' => 'bar']);

// Using the logger helper
logger($message, $context);

Testing

composer test

License

laravel-gelf-logger is released under the MIT Licence. See the bundled LICENSE file for details.

laravel-gelf-logger's People

Contributors

andrew-nuwber avatar arnidan avatar berkaygure avatar chococrypto avatar hedii avatar jesperbeisner avatar patriziotomato avatar qwert1x avatar rytisder avatar stefant123 avatar tumichnix avatar yaapis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-gelf-logger's Issues

Does not send data after 60 seconds of waiting

A simple example:

\Log::info('test 1');
sleep(61);
\Log::info('test 2');

The 'test 2' record will never get into the grayLog.

But if I do so:

\Log::info('test 1');
sleep(61);
\Log::info('test 2');
\Log::info('test 3');

The grayLog will contain the following entries:

test 1
test 3

test 2 is missing again.

It seems that there is a timeout of 60 seconds. I found a similar setup in a Java package. But there is no such setting in your package.

reconnectInterval: Time interval (in seconds) after an existing connection is closed and re-opened. A value of -1 disables automatic reconnects. Default: 60 seconds

"Message is invalid" exception thrown by gelf-php when logging an empty string.

Hi! First of all, thanks for making this wrapper. It's super useful. However, I've run into an interesting issue that I'd value your input on.

When logging an empty string with a call like Log::debug(''), the gelf-php library you're wrapping will throw this exception:

Message is invalid: short-message not set {"exception":"[object] (RuntimeException(code: 0): Message is invalid: short-message not set at /path/to/graylog2/gelf-php/src/Gelf/Publisher.php:71

We discovered this inside of a try/catch where a developer had left a call to Log::debug($ex->getMessage()). In this case, the exception message was an empty string. The gelf exception was actually being thrown inside of the catch block, and since there was nothing to catch that, we ended up serving 500s for this particular codepath for a little while ๐Ÿ˜….

I've corrected my original issue, and I think further problems are preventable on our side if I write a Processor. However, I thought it might be a good idea to bring this issue to your attention, since there's a difference between how any other monolog driver would handle an empty string vs laravel-gelf-logger.

If this isn't a bug, do you have any suggestions for how I could best prevent this in the future?

Thanks!

problem to send log to graylog

According to test this package with laravel 7.14 the logs didn't send to graylog at all i debug it step by step and found out the problem is this part of code :

foreach ($this->parseProcessors($config) as $processor) {
            $handler->pushProcessor(new $processor);
        }

in line 80 of this file GelfLoggerFactory.php
when i comment this part of code every things work fine!
i use tcp as my config to send logs.

Unable to send logs to Graylog

I'm still unable to send logs to Graylog with my Setup, please help :'(

logging.php

    'channels' => [
        'stack' => [
            'driver' => 'stack',
            'channels' => ['single', 'gelf'],
            'ignore_exceptions' => false,
        ],

        'gelf' => [
            'driver' => 'custom',
            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,
            'level' => env('LOG_LEVEL', 'debug'),
            'name' => 'my-custom-name',
            'transport' => 'http',
            'host' => '0.0.0.0',
            'port' => 12201,
        ]

Controller to send Log

        $request = new Request([
            'version' => '1.1',
            'host' => '127.0.0.1',
            'short_message' => 'mama mo skkkrt',
            'level' => 1,
        ]);
 
        Log::channel('gelf')->debug('s', $request->all());

Thanks in advance :D

Is this package is available for Laravel 8 ?

It would be nice to know for which version of Laravel this package is available.

For example by adding this to the Readme :

Laravel laravel-gelf-logger
5.6 ^3.0
5.7 ^4.0
5.8 ^5.0
6.0 ^6.0
7.0 ^7.0
8.0 ^8.0

Can't Receive messages on Graylog

I'm unable to receive any message from Laravel on Graylog and I don't know what is happening. Here is my config

logging.php

'stack' => [
            'driver' => 'stack',
            'channels' => ['gelf', 'stderr', 'daily'],
            'ignore_exceptions' => false,
        ],
'gelf' => [
            'driver' => 'custom',

            'via' => \Hedii\LaravelGelfLogger\GelfLoggerFactory::class,

            // This optional option determines the processors that should be
            // pushed to the handler. This option is useful to modify a field
            // in the log context (see NullStringProcessor), or to add extra
            // data. Each processor must be a callable or an object with an
            // __invoke method: see monolog documentation about processors.
            // Default is an empty array.
            'processors' => [
                \Hedii\LaravelGelfLogger\Processors\NullStringProcessor::class,
                \Hedii\LaravelGelfLogger\Processors\RenameIdFieldProcessor::class,
                // another processor...
            ],

            // This optional option determines the minimum "level" a message
            // must be in order to be logged by the channel. Default is 'debug'
            'level' => 'debug',

            // This optional option determines the channel name sent with the
            // message in the 'facility' field. Default is equal to app.env
            // configuration value
            'name' => 'my-custom-name',

            // This optional option determines the system name sent with the
            // message in the 'source' field. When forgotten or set to null,
            // the current hostname is used.
            'system_name' => null,

            // This optional option determines if you want the UDP, TCP or HTTP
            // transport for the gelf log messages. Default is UDP
            'transport' => 'udp',

            // This optional option determines the host that will receive the
            // gelf log messages. Default is 127.0.0.1
            'host' => 'graylog',

            // This optional option determines the port on which the gelf
            // receiver host is listening. Default is 12201
            'port' => 12111,

            // This optional option determines the path used for the HTTP
            // transport. When forgotten or set to null, default path '/gelf'
            // is used.
            'path' => null,
            
            // This optional option enable or disable ssl on TCP or HTTP
            // transports. Default is false.
            'ssl' => false,
            
            // If ssl is enabled, the following configuration is used.
            'ssl_options' => [
                // Enable or disable the peer certificate check. Default is
                // true.
                'verify_peer' => true,
                
                // Path to a custom CA file (eg: "/path/to/ca.pem"). Default
                // is null.
                'ca_file' => null,
                
                // List of ciphers the SSL layer may use, formatted as
                // specified in ciphers(1). Default is null.
                'ciphers' => null,
                
                // Whether self-signed certificates are allowed. Default is
                // false.
                'allow_self_signed' => false,
            ],

            // This optional option determines the maximum length per message
            // field. When forgotten or set to null, the default value of 
            // \Monolog\Formatter\GelfMessageFormatter::DEFAULT_MAX_LENGTH is
            // used (currently this value is 32766)
            'max_length' => null,

            // This optional option determines the prefix for 'context' fields
            // from the Monolog record. Default is null (no context prefix)
            'context_prefix' => null,

            // This optional option determines the prefix for 'extra' fields
            // from the Monolog record. Default is null (no extra prefix)
            'extra_prefix' => null,
            
            // This optional option determines whether errors thrown during
            // logging should be ignored or not. Default is true.
            'ignore_error' => true,

        ],

docker-compose.yml

version: '2'

services:
  redis:
    image: redis:7
    command: redis-server --requirepass
    hostname: redis
    ports:
      - '6379:6379'
  local:
    tty: true
    image: docker.io/bitnami/laravel:9
    environment:
      - DB_HOST=db-app
      - DB_USERNAME=${DB_USERNAME}
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_DATABASE=${DB_DATABASE}
      - APP_NAME=Laravel
      - APP_ENV=local
      - APP_KEY=base64:
      - APP_DEBUG=true
      - APP_URL=http://localhost
      - SERVER_PORT=3000
      - LOG_CHANNEL=stack
      - LOG_LEVEL=debug
      - DB_CONNECTION=mysql
      - BROADCAST_DRIVER=log
      - CACHE_DRIVER=none
      - FILESYSTEM_DISK=local
      - SESSION_DRIVER=file
      - SESSION_LIFETIME=120
      - MEMCACHED_HOST=127.0.0.1
      - REDIS_CLIENT=predis
      - REDIS_HOST=redis
      - REDIS_PASSWORD=
      - REDIS_PORT=6379
      - SES_KEY="{AWS_ACCESS_KEY_ID}"
      - SES_SECRET="{AWS_SECRET_ACCESS_KEY}"
      - SES_REGION=us-east-1
      - MAIL_ENCRYPTION=tls
      - MAIL_FROM_ADDRESS=
      - MAIL_FROM_NAME="${APP_NAME}"
      - AWS_ACCESS_KEY_ID="{AWS_ACCESS_KEY_ID}"
      - AWS_SECRET_ACCESS_KEY="{AWS_SECRET_ACCESS_KEY}"
      - AWS_DEFAULT_REGION=us-east-1
      - AWS_BUCKET=
      - AWS_USE_PATH_STYLE_ENDPOINT=true
      - PUSHER_APP_ID=
      - PUSHER_APP_KEY=
      - PUSHER_APP_SECRET=
      - PUSHER_APP_CLUSTER=mt1
      - MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
      - MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
      - BITNAMI_DEBUG=true
      - CONTAINER_ROLE=app
      - QUEUE_CONNECTION=sync
      - MONOPOLY_API_URL="${MONOPOLY_API_URL}"
      - MONOPOLY_API_KEY="${MONOPOLY_API_KEY}"
      - MONOPOLY_API_DEBUG=true
    ports:
      - 1230:8000
    volumes:
      - ./:/app
    depends_on:
      - redis
      - db-app
  db-app:
    image: 'mysql'
    ports:
      - '3306:3306'
    volumes:
      - '../dbentrypoint:/docker-entrypoint-initdb.d'
      - '../databasedump:/var/lib/mysql'
    environment:
      # ALLOW_EMPTY_PASSWORD is recommended only for development.
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_DATABASE=
  mongodb:
    image: mongo:4.2
    volumes:
      - mongo_data:/data/db
    restart: unless-stopped

  elasticsearch: # ElasticSearch service
    restart: unless-stopped
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:7.10.2 # Version of elasticsearch image
    volumes:
      - es_data:/usr/share/elasticsearch/data # Persisted elasticsearch data
    environment:
      - http.host=0.0.0.0
      - transport.host=localhost
      - network.host=0.0.0.0
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    mem_limit: 1g

  graylog:
    image: graylog/graylog:4.2 # Version of Graylog docker image
    volumes:
      - graylog_data:/usr/share/graylog/data # Persisted Graylog data
    environment:
      - GRAYLOG_PASSWORD_SECRET=segredonaotaosecreto
      # Password: admin
      - GRAYLOG_ROOT_PASSWORD_SHA2=8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918
      - GRAYLOG_HTTP_EXTERNAL_URI=http://127.0.0.1:9000/
      - GRAYLOG_WEB_ENDPOINT_URI=http://127.0.0.1:9000/api
    entrypoint: /usr/bin/tini -- wait-for-it elasticsearch:9200 --  /docker-entrypoint.sh
    links:
      - mongodb:mongo
      - elasticsearch
    restart: unless-stopped
    depends_on:
      - mongodb
      - elasticsearch
    ports:
      - "9000:9000"
      # Syslog TCP
      - "1514:1514"
      # Syslog UDP
      - "1514:1514/udp"
      # GELF TCP
      - "12201:12201"
      # GELF UDP
      - "12111:12111/udp"

volumes:
  mongo_data:
  es_data:
  graylog_data:

Any help on what I did wrong?

Log messages over HTTP to graylog

Hey @hedii ,

you wrote that you "only" wrote a wrapper for the package bzikarsky/gelf-php for Laravel. The readme of gelf-php says that it is also possible to send GELF over HTTP I'm trying to get this working with your package for quite some time now, but unfortunately without success so far. 'transport' => 'http' seems not to work either.

Is it possible that the wrapper does not offer this or that there is no mapping to bzikarsky/gelf-php? I haven't really looked into your code yet.

-Florian

RuntimeException when Graylog SSL expired

Hi,

first, thanks for the package!

I ran into an issue while using it and connecting to a Graylog instance via HTTPS. The Graylog SSL expired and I got the following error:

Failed to create socket-client for ssl://graylog.example.com:6000: (0) {"userId":1,"exception":"[object] (RuntimeException(code: 0): Failed to create socket-client for ssl://graylog.example.com:6000: (0) at /path/to/laravel/vendor/graylog2/gelf-php/src/Gelf/Transport/StreamSocketClient.php:157)

Is that something that can be fixed in your package, or does the Exception need to be handled in graylog2/gelf-php?

Thanks!

Is there any way to set GELF spec version to 1.1 ?

I'm trying to set the GELF version output payload to 1.1 (as Graylog documentation require), instead of 1.0, but I cannot find any obvious way to do so.
I've observed that in Message class there's a setVersion() method, but I have no clue how could I reach that instance from a processor.

Any idea where to start?

udp and openvpn

Laravel version: 10.13.0
hedii/laravel-gelf-logger version: 8.0.1

Can you add the possibility to set the third parameter of UdpTransport class?

public function __construct( string $host = self::DEFAULT_HOST, int $port = self::DEFAULT_PORT, private int $chunkSize = self::CHUNK_SIZE_WAN )

If the message is too long (backtrace), the message is not send to my graylog server.

Here are some explanation about the MTU issue with OpenVpn:

bzikarsky/gelf-php#117 (comment)

If I override this line from GelfLoggerFactory.php file, I can receive the message to my graylog server:

default => new UdpTransport($host, $port, 1200),

instead of

default => new UdpTransport($host, $port),

README.md update

It looks like the conf/logging.php causes errors when used in lumen 1.0.

When adding 'gelf' to the 'stack' logs, I observe the following errors, causing Monolog to automatically fall back to default laravel logging.

[2023-08-14 15:08:26] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): PsrLogMessageProcessor must be an instance of Monolog\\Processor\\ProcessorInterface at /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php:393)
[stacktrace]
#0 /home/yli/work/service-search-index/vendor/illuminate/collections/Traits/EnumeratesValues.php(236): Illuminate\\Log\\LogManager->Illuminate\\Log\\{closure}()
#1 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(389): Illuminate\\Support\\Collection->each()
#2 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(222): Illuminate\\Log\\LogManager->createMonologDriver()
#3 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(137): Illuminate\\Log\\LogManager->resolve()
#4 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(124): Illuminate\\Log\\LogManager->get()
#5 /home/yli/work/service-search-index/vendor/illuminate/log/LogManager.php(113): Illuminate\\Log\\LogManager->driver()
#6 /home/yli/work/service-search-index/vendor/illuminate/support/Facades/Facade.php(353): Illuminate\\Log\\LogManager->channel()
#7 /home/yli/work/service-search-index/routes/web.php(21): Illuminate\\Support\\Facades\\Facade::__callStatic()
#8 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(36): Closure->{closure}()
#9 /home/yli/work/service-search-index/vendor/illuminate/container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(81): Illuminate\\Container\\Util::unwrapIfClosure()
#11 /home/yli/work/service-search-index/vendor/illuminate/container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#12 /home/yli/work/service-search-index/vendor/illuminate/container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#13 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(304): Illuminate\\Container\\Container->call()
#14 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(269): Laravel\\Lumen\\Application->callActionOnArrayBasedRoute()
#15 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\\Lumen\\Application->handleFoundRoute()
#16 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(431): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}()
#17 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(167): Laravel\\Lumen\\Application->sendThroughPipeline()
#18 /home/yli/work/service-search-index/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(112): Laravel\\Lumen\\Application->dispatch()
#19 /home/yli/work/service-search-index/public/index.php(28): Laravel\\Lumen\\Application->run()
#20 {main}
"} 

Removing the 'processors' block inside the 'gelf' config appears to clear this error. I'm not an expert but it appears that your Processor classes are not implementing the right interface for Monolog to be happy.

Laravel Lumen 5.7 Error

Got exception like this,,,installed version: "hedii/laravel-gelf-logger": "^3.1",

[2023-11-30 13:49:10] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (Error(code: 0): Class 'Hedii\\LaravelGelfLogger\\Processors\\RenameIdFieldProcessor' not found at /var/www/vendor/hedii/laravel-gelf-logger/src/GelfLoggerFactory.php:72)
[stacktrace]
#0 /var/www/vendor/illuminate/log/LogManager.php(205): Hedii\\LaravelGelfLogger\\GelfLoggerFactory->__invoke(Array)
#1 /var/www/vendor/illuminate/log/LogManager.php(178): Illuminate\\Log\\LogManager->createCustomDriver(Array)
#2 /var/www/vendor/illuminate/log/LogManager.php(102): Illuminate\\Log\\LogManager->resolve('gelf')
#3 /var/www/vendor/illuminate/log/LogManager.php(90): Illuminate\\Log\\LogManager->get('gelf')
#4 /var/www/vendor/illuminate/log/LogManager.php(79): Illuminate\\Log\\LogManager->driver('gelf')
#5 /var/www/vendor/illuminate/support/Facades/Facade.php(237): Illuminate\\Log\\LogManager->channel('gelf')
#6 /var/www/app/Http/Controllers/EjbcaController.php(1656): Illuminate\\Support\\Facades\\Facade::__callStatic('channel', Array)
#7 [internal function]: App\\Http\\Controllers\\EjbcaController->ping(Object(Laravel\\Lumen\\Http\\Request))
#8 /var/www/vendor/illuminate/container/BoundMethod.php(29): call_user_func_array(Array, Array)
#9 /var/www/vendor/illuminate/container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /var/www/vendor/illuminate/container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Laravel\\Lumen\\Application), Array, Object(Closure))
#11 /var/www/vendor/illuminate/container/Container.php(572): Illuminate\\Container\\BoundMethod::call(Object(Laravel\\Lumen\\Application), Array, Array, NULL)
#12 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(378): Illuminate\\Container\\Container->call(Array, Array)
#13 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(344): Laravel\\Lumen\\Application->callControllerCallable(Array, Array)
#14 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(318): Laravel\\Lumen\\Application->callLumenController(Object(App\\Http\\Controllers\\EjbcaController), 'ping', Array)
#15 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(280): Laravel\\Lumen\\Application->callControllerAction(Array)
#16 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(265): Laravel\\Lumen\\Application->callActionOnArrayBasedRoute(Array)
#17 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(165): Laravel\\Lumen\\Application->handleFoundRoute(Array)
#18 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(418): Laravel\\Lumen\\Application->Laravel\\Lumen\\Concerns\\{closure}(Object(Laravel\\Lumen\\Http\\Request))
#19 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(171): Laravel\\Lumen\\Application->sendThroughPipeline(Array, Object(Closure))
#20 /var/www/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(108): Laravel\\Lumen\\Application->dispatch(NULL)
#21 /var/www/public/index.php(29): Laravel\\Lumen\\Application->run()
#22 {main}
"} 

when installing the latest version got error:

root@c5e200d9f50e:/var/www# composer require hedii/laravel-gelf-logger
Using version ^6.2 for hedii/laravel-gelf-logger
./composer.json has been updated
Running composer update hedii/laravel-gelf-logger
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires hedii/laravel-gelf-logger ^6.2 -> satisfiable by hedii/laravel-gelf-logger[6.2.0].
    - hedii/laravel-gelf-logger 6.2.0 requires illuminate/log ^8.12 -> found illuminate/log[v8.12.0, ..., 8.x-dev] but the package is fixed to v5.7.28 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
You can also try re-running composer require with an explicit version constraint, e.g. "composer require hedii/laravel-gelf-logger:*" to figure out if any version is installable, or "composer require hedii/laravel-gelf-logger:^2.1" if you know which you need.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

How to resolve this? thanks

Trait 'Illuminate\Log\ParsesLogConfiguration' not found

Hi,

I try to use your package with Laravel 5.6.
If I call "Log:channel('gelf')->:critical('Foobar');" I am getting "Symfony\Component\Debug\Exception\FatalErrorException : Trait 'Illuminate\Log\ParsesLogConfiguration' not found".

Stacktrace:

  1   Symfony\Component\Debug\Exception\FatalErrorException::__construct()
      /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:137

  2   Illuminate\Foundation\Bootstrap\HandleExceptions::fatalExceptionFromError()
      /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:123

Multiple JSONs in one message

Hi,

sometimes the JSON messages are wrapped in one message. So the extractor can extract only the first JSON and not the rest. The search for the messages is no longer possible.

It then looks like this:

{
   "version":"1.0",
   "host":"hu-srv-web01",
   "short_message":"No news notifications to be sent - continuing",
   "level":6,
   "timestamp":1616021766.570789,
   "facility":"production",
   "_process":"notification"
}{
   "version":"1.0",
   "host":"hu-srv-web01",
   "short_message":"No news notifications to be sent - continuing",
   "level":6,
   "timestamp":1616021823.716051,
   "facility":"production",
   "_process":"v3_notification",
   "_job":"App\\Jobs\\V3AllSendNewsNotificationSmartKisJob"
}

What can be the reason for this?

'name' field is not sent in 'facility' field.

Even when 'name' field is set in the logging configuration, 'facility' field has 'local' (app.env value) when it's sent to graylog2.

Using laravel/framework:^6.2 and hedii/laravel-gelf-logger:^4.0, with a completely new laravel project.

Add extra data to the gelf messages

Hi there,

I am currently using Laravel 10 and laravel-gelf-logger 8.0.1 and have some hard times trying to have a custom processor able to add extra information to the gelf message.

When I have this it is all good, the message is sent to my graylog server :

image

But when I add more data in the array like below, then nothing is sent to the server :

image

Any idea of the reason ?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.