Skip to content

Unable to set JSON log format on cloudwatch #2963

Open
@brunoargolo

Description

@brunoargolo

When I locally run ADOT collector with the config below it correctly prints JSON formatted logs to the console.

However when I deploy to ecs fargate, the cloudwatch logs they are not in JSON format.

config.yaml

extensions:
  awsproxy:

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4317
      http:
        endpoint: 0.0.0.0:4318

processors:
  batch:

exporters:
  debug:
    verbosity: detailed
  awsxray:
    region: eu-west-1
  

service:
  extensions: [awsproxy]
  telemetry:
    logs:
      level: info
      encoding: json
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [awsxray]

Console output locally:
{"level":"info","ts":"2025-02-11T19:57:24.770Z","caller":"extensions/extensions.go:42","msg":"Extension is starting...","kind":"extension","name":"awsproxy"} {"level":"info","ts":"2025-02-11T19:57:24.770Z","caller":"[email protected]/extension.go:39","msg":"X-Ray proxy server started on localhost:2000","kind":"extension","name":"awsproxy"}

CloudWatch output:
`
2025-02-11T19:57:42.288Z | Span #2

  2025-02-11T19:57:42.288Z | Trace ID : 67ababa1e574f5997db10cb9f7e00cde
  2025-02-11T19:57:42.288Z | Parent ID :
  2025-02-11T19:57:42.288Z | ID : edef07aac44a2a9e
  2025-02-11T19:57:42.288Z | Name : POST
  2025-02-11T19:57:42.288Z | Kind : Client
  2025-02-11T19:57:42.288Z | Start time : 2025-02-11 19:57:21.467 +0000 UTC
  2025-02-11T19:57:42.288Z | End time : 2025-02-11 19:57:41.469642293 +0000 UTC
  2025-02-11T19:57:42.288Z | Status code : Unset
  2025-02-11T19:57:42.288Z | Status message :
  2025-02-11T19:57:42.288Z | Attributes:
  2025-02-11T19:57:42.288Z | -> http.url: Str(https://sqs.eu-west-1.amazonaws.com/)

`
How do I configure it to use JSON format in cloudwatch ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions