Skip to content

ECS structured logging logs some ECS fields with incorrect types #49270

@N4zroth

Description

@N4zroth

Hey,

we're using Spring Boot 4.0.2 with structured logging in ECS format enabled:

logging:
  structured:
    format:
      console: ecs
      file: ecs

According to ECS's documentation, there are fields that should not be a String, e. g. url.port. Problem is, this and probably others are logged as String as can be seen here.

I understand that this is not easy solvable as all MDC fields are String, but this violates the ECS standard and produces lots of problems when ingested in an Elastic cluster without transformation.
It'd probably best if the logger checked ECS field types and only logged them if they were convertible to the type required by the spec.

We're currently solving this by using special transformations in the spring-logback.xml which also doesn't feel good.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: team-onlyAn issue that's best handled directly by the team rather than a community contribution.type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions