Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monolog Bundle using Elasticsearch type throws errors for Doctrine channel #40354

Closed
DavidGarciaCat opened this issue Mar 3, 2021 · 4 comments

Comments

@DavidGarciaCat
Copy link

Symfony version(s) affected:

v5.2.3 (the one I use for the current project - unknown for other versions)

Description

I don't know if this issue symfony/monolog-bundle#391 might be more relevant here or if it should stay in the other repo

How to reproduce

The error message + the configuration is already there, as well as how to reproduce the error

Possible Solution

🤷‍♂️ Don't throw the context error 🙂

Additional context

image

$ composer show | grep symfony
symfony/amqp-messenger                   v5.2.3            
symfony/asset                            v5.2.3            
symfony/browser-kit                      v5.2.3            
symfony/cache                            v5.2.3            
symfony/cache-contracts                  v2.2.0            
symfony/config                           v5.2.3            
symfony/console                          v5.2.3            
symfony/css-selector                     v5.2.3            
symfony/debug-bundle                     v5.2.3            
symfony/dependency-injection             v5.2.3            
symfony/deprecation-contracts            v2.2.0            
symfony/doctrine-bridge                  v5.2.3            
symfony/doctrine-messenger               v5.2.3            
symfony/dom-crawler                      v5.2.3            
symfony/dotenv                           v5.2.3            
symfony/error-handler                    v5.2.3            
symfony/event-dispatcher                 v5.2.3            
symfony/event-dispatcher-contracts       v2.2.0            
symfony/expression-language              v5.2.3            
symfony/filesystem                       v5.2.3            
symfony/finder                           v5.2.3            
symfony/flex                             v1.12.2           
symfony/form                             v5.2.3            
symfony/framework-bundle                 v5.2.3            
symfony/http-client-contracts            v2.3.1            
symfony/http-foundation                  v5.2.3            
symfony/http-kernel                      v5.2.3            
symfony/intl                             v5.2.3            
symfony/mailer                           v5.2.3            
symfony/maker-bundle                     v1.29.1           
symfony/messenger                        v5.2.3            
symfony/mime                             v5.2.3            
symfony/monolog-bridge                   v5.2.3            
symfony/monolog-bundle                   v3.6.0            
symfony/options-resolver                 v5.2.3            
symfony/orm-pack                         v2.1.0            
symfony/phpunit-bridge                   v5.2.3            
symfony/polyfill-intl-grapheme           v1.22.1           
symfony/polyfill-intl-icu                v1.22.1           
symfony/polyfill-intl-idn                v1.22.1           
symfony/polyfill-intl-normalizer         v1.22.1           
symfony/polyfill-mbstring                v1.22.1           
symfony/polyfill-php72                   v1.22.1           
symfony/polyfill-php73                   v1.22.1           
symfony/polyfill-php80                   v1.22.1           
symfony/process                          v5.2.3            
symfony/property-access                  v5.2.3            
symfony/property-info                    v5.2.3            
symfony/proxy-manager-bridge             v5.2.3            
symfony/redis-messenger                  v5.2.3            
symfony/routing                          v5.2.3            
symfony/security-acl                     v3.1.1            
symfony/security-bundle                  v5.2.3            
symfony/security-core                    v5.2.3            
symfony/security-csrf                    v5.2.3            
symfony/security-guard                   v5.2.3            
symfony/security-http                    v5.2.3            
symfony/service-contracts                v2.2.0            
symfony/stopwatch                        v5.2.3            
symfony/string                           v5.2.3            
symfony/templating                       v5.2.3            
symfony/translation                      v5.2.3            
symfony/translation-contracts            v2.3.0            
symfony/twig-bridge                      v5.2.3            
symfony/twig-bundle                      v5.2.3            
symfony/validator                        v5.2.3            
symfony/var-dumper                       v5.2.3            
symfony/var-exporter                     v5.2.3            
symfony/web-profiler-bundle              v5.2.3            
symfony/yaml                             v5.2.3

$ composer show | grep doctrine
doctrine/annotations                     1.11.1            
doctrine/cache                           1.10.2            
doctrine/collections                     1.6.7             
doctrine/common                          3.1.1             
doctrine/data-fixtures                   1.5.0             
doctrine/dbal                            2.12.1            
doctrine/doctrine-bundle                 2.2.3             
doctrine/doctrine-fixtures-bundle        3.4.0             
doctrine/doctrine-migrations-bundle      3.0.2             
doctrine/event-manager                   1.1.1             
doctrine/inflector                       2.0.3             
doctrine/instantiator                    1.4.0             
doctrine/lexer                           1.2.1             
doctrine/migrations                      3.1.0             
doctrine/orm                             2.8.2             
doctrine/persistence                     2.1.0             
doctrine/sql-formatter                   1.1.1             
ramsey/uuid-doctrine                     1.6.0             
symfony/doctrine-bridge                  v5.2.3            
symfony/doctrine-messenger               v5.2.3

$ composer show | grep elastic
elasticsearch/elasticsearch              v7.11.0           
ruflin/elastica                          7.1.0
@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@DavidGarciaCat
Copy link
Author

Answering CarsonBot, no, I didn't find any other solution so far...

@carsonbot carsonbot removed the Stalled label Sep 4, 2021
@ProfChene
Copy link

Hi there,

Don't know in which repository to post, so I'm copy-pasting my message here too :

Hi there,

We got the same issue in our project.
I noticed that in the document sent to Elasticsearch, the context value for doctrine channel is an array of int instead of an object, as it is in other channels.
This leads to mapping errors in Elasticsearch, thus it responds with an error to the curl call made by Elastica.

Here is an example of document for the event channel :

{
  "message": "Notified event \"{event}\" to listener \"{listener}\".",
  "context": {
    "event": "debug.security.authorization.vote",
    "listener": "Symfony\\Bundle\\SecurityBundle\\EventListener\\VoteListener::onVoterVote"
  },
  "level": 100,
  "level_name": "DEBUG",
  "channel": "event",
  "datetime": "2021-11-15T10:30:01.720644+00:00",
  "extra": []
}

And here is an example for the doctrine channel :

{
  "message": "ANY SQL REQUEST HERE",
  "context": [
    1
  ],
  "level": 100,
  "level_name": "DEBUG",
  "channel": "doctrine",
  "datetime": "2021-11-15T10:30:01.723233+00:00",
  "extra": []
}

As I understand it (am an Elasticsearch noob), all values should have the same format for a given index, otherwise Elasticsearch will have mapping errors.
The context here have 2 different formats : object and array, so it doesn't work.

@derrabus
Copy link
Member

Closing in favor of symfony/monolog-bundle#391

@symfony symfony locked as resolved and limited conversation to collaborators Nov 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants