-
Notifications
You must be signed in to change notification settings - Fork 40
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
ecs-pino-format with convertReqRes wrong http field format #102
Comments
Hi. Thanks for the bug report. This is probably the right place to have reported. It may be a little while before I'm able to take a look. I haven't used NestJS before, so any getting started steps or a more complete reproduction case might help me out. |
I will try to prepare a repository with the whole setup tonight. |
Hi, here (https://github.com/Donorlin/ecs-pino-nest-issue) is a starter project. Sorry for the boilerplate. It was created with nest-cli. It is as simple as I have been messing around with your source file (https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/pino/index.js) and I found out that When I tried to add something like
Log was actually filled with what would be expected. But log also still had Hopefully this helps. Let me know if I can help. I did not want to create any pull request because I do not know if it is intentional for Thank you |
any news on this? |
I had the same problem this is how I managed to solve it if anyone is interested https://stackoverflow.com/questions/69708256/http-pino-logger-and-elastic-common-schema-ecs-format-in-nestjs. |
So bassically you format the log manually? |
Exactly, I created a formater and merge it with the |
Can you share the formater function 😃 ? thanks in advance! |
https://gist.github.com/gkampitakis/b36819f38f8886598c20ed1af7245e3a here is a gist example of how we use it. I have removed some parts as we do specific formats for our needs. Hope this helps you to achieve what you want 🤞 |
thanks, works like a charm! |
Hi,
I am using NestJS with nestjs-pino and I am trying to set up
ecsFormat({ convertReqRes: true })
. Logging of request and response works, but format is odd.If this is meant for
nestjs-pino
i am sorry just let me know. Thank youVersions I am using:
Node: 14.17.3
npm: 7.23.0
nestjs: latest setup
@elastic/ecs-pino-format: 1.3.0
nestjs-pino: 2.2.0
pino-http: 5.7.0
Usage
In this picture, you can see
ecsFormat
withconvertReqRes
set tofalse
behaves as expected withreq
andres
logged in their separate fields.In this picture, convertReqRes was set to true. As you can see
response
field is inHTTP
, butreq
is not and the log is missingurl
anduser_agent
fields (maybe others as well).Expected behavior
Correct format as shown in elastic/pino-http-logging
Thank you for your response, please let me know if this does not belong here.
The text was updated successfully, but these errors were encountered: