Skip to content

ecs-pino-format with convertReqRes wrong http field format #102

@Donorlin

Description

@Donorlin

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.
convertReqRes-false

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).
convertReqRes-true

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-nodejsMake available for APM Agents project planning.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions