Skip to content

expose event_name in log context #40230

Closed
@tdelabro

Description

@tdelabro

Component(s)

No response

Is your feature request related to a problem? Please describe.

https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/contexts/ottllog

Here are listed all the field I can access in stuffs like transform: log_statments but it doesn't expose the event_name field, while this one is part of the context.

I get this error:

Error: invalid configuration: processors::transform: unable to parse OTTL statement "set(log.attributes[\"event_name\"], log.event_name)": error while parsing arguments for call to "set": invalid argument at position 1: segment "event_name" from path "log.event_name" is not a valid path nor a valid OTTL keyword for the log context - review https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/pkg/ottl/contexts/ottllog to see all valid paths

when doing:

  transform:
    error_mode: ignore
    log_statements:
    - context: log
      statements:
      - set(attributes["event_name"], event_name)

Describe the solution you'd like

I would like to be able to access it.

I need it for Loki

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions