Skip to content

[receiver/cloudflare]: Support extracting all attributes in Cloudflare receiver #40318

Closed
@panys9

Description

@panys9

Component(s)

receiver/cloudflare

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

Since the Cloudflare receiver by default map all fields in the payload to attributes it should support all data types. Currently it generated a warning which becomes a lot of warnings.

Payload in the body:

{
  "ClientIP": "something",
  "ClientRequestHost": "something",
  "ClientRequestMethod": "POST",
  "ClientRequestURI": "/",
  "EdgeEndTimestamp": "2025-05-27T07:45:17Z",
  "EdgeResponseBytes": 648,
  "EdgeResponseStatus": 200,
  "EdgeStartTimestamp": "2025-05-27T07:45:17Z",
  "RayID": "9463e45639ff0a61",
  "RequestHeaders": {}
}

Warning:
warn [email protected]/logs.go:314 unable to translate field to attribute, unsupported type {"otelcol.component.id": "cloudflare", "otelcol.component.kind": "receiver", "otelcol.signal": "logs", "field": "RequestHeaders", "value": {}, "type": "map[string]interface {}"}"

Describe the solution you'd like

Either add support for extracting the fields sent or make it configurable so the receiver doesn't try to extract attributes automatically.

Describe alternatives you've considered

It is possible to solve this using the transform processor but since the receiver does the same it result in wasted cpu.

Processor config:

      transform:
        error_mode: ignore
        log_statements:
          - context: log
            statements:
              - merge_maps(cache, body, "upsert") where IsMatch(body, "^\\{")
              - set(attributes, cache)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions