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

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

Closed andho closed 4 years ago

andho commented 4 years ago

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.

hedii commented 4 years ago

Please paste your full logging.php config. I use this package on multiple projects, and i do have the right facility set correctly.

andho commented 4 years ago

logging.php.

If I set the APP_ENV to something else, it's reflected correctly in graylog2.

andho commented 4 years ago

There is no issue when using 'gelf' channel directly with LOG_CHANNEL=gelf, but when using LOG_CHANNEL=stack, this issue occurs, even if the only channel in the stack is gelf.

Using the gelf channel directly also works correctly, so I assume this is an issue with the stack driver.

Will file a bug report there.

genrmiranda commented 4 years ago

I have this issue as well gelf does not work on stack

andho commented 4 years ago

@genrmiranda I ended up not reporting this as a bug, as it seems this is the intended behavior of the stack driver. I just resolved to setting the name field in the stack driver directly, which seems to work, If I recall correctly. If it doesn't work let me know, I'll have to dig up the code and double check.

ElectroBuddha commented 3 years ago

I can confirm that following 'stack' setup is correctly setting 'facility' field when logging to 'stack' channel:

'channels' => [
      'stack' => [
          'driver' => 'stack',
          'channels' => ['single', 'gelf'],
          'name' => 'some facility value'
      ],
      ...
romandots commented 11 months ago

I'm having the same issue with stack driver. Log sent via channel 'gelf' has the facility defined in the name config. Logs sent to stack has the default value (which is app.env).

hedii commented 10 months ago

@romandots I don't see any issue with that. Stack is configured by laravel not by gelf package, it uses its own name.

If you want to use stack and change the name, look at the comment just before yours (I have not tested it myself)

romandots commented 10 months ago

@romandots I don't see any issue with that. Stack is configured by laravel not by gelf package, it uses its own name.

If you want to use stack and change the name, look at the comment just before yours (I have not tested it myself)

Yes indeed, you are right. The solution above is working, so it's probably not an issue.