ecs-pino-format with convertReqRes wrong http field format
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
- Domain
- observability-sre
Research direction
Start at the ecsFormat({ convertReqRes: true }) entry point and reproduce the request and response logging with the versions and NestJS setup shown. Compare the output with the linked ECS pino-http example; done means the request fields, including url and user_agent, and the response field are mapped to the expected HTTP structure.
Written by the indexing model from the issue text.
Description
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 you
Versions 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
@Module({
imports: [
LoggerModule.forRoot({
pinoHttp: { ...ecsFormat({ convertReqRes: true }) },
}),
],
})
export class AppModule {}
In this picture, you can see ecsFormat with convertReqRes set to false behaves as expected with req and res logged in their separate fields.

In this picture, convertReqRes was set to true. As you can see response field is in HTTP, but req is not and the log is missing url and user_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.
- Dominant language
- JavaScript
- Stars
- 69
- Forks
- 45
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from elastic/ecs-logging-nodejs
-
Support of pino 9.x Opencommunity triage
Difficulty 5/5 Over a week Newbie friendliness 20/100
elastic/ecs-logging-nodejs#223 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
elastic/ecs-logging-nodejs#222 ·
-
community triage
elastic/ecs-logging-nodejs#189 · 8 comments · 1 assignee ·
-
community triage
Difficulty 4/5 3-5 days Newbie friendliness 25/100
elastic/ecs-logging-nodejs#184 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
elastic/ecs-logging-nodejs#183 ·
All issues in elastic/ecs-logging-nodejs
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
[Block] Latest Posts [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·