Hi Team I ran otel-collector as a daemon service i...
# support
d
Hi Team I ran otel-collector as a daemon service in my ecs cluster. In my taskdefinition for otel-collector I mounted the
/var/lib/docker/containers
directory and the
/var/run/docker.sock
Now the thing is, if I use
detectors: [ "env", "docker", "ecs" ]
The ecs detector will populate my logs with the task metadata information only from the otel-collector task itself, and hence all my logs had the same value for aws.ecs.task.family (dev-otel-collector-taskdef) What is the best way to approach this? How do we enrich all necessary information before pushing to signoz? My otel-collector config:
Copy code
extensions:
  health_check:
    endpoint: 0.0.0.0:13133
    path: "/health"

receivers:
  otlp:
    protocols:
      grpc: {}
      http: {}

  filelog:
    include: ["/var/lib/docker/containers/*/*-json.log"]
    exclude: ["/var/lib/docker/containers/*/*.cache"]
    start_at: beginning
    include_file_path: true

    operators:
      # 1. Extract container_id from file path.
      - type: regex_parser
        id: extract_container_id
        parse_from: attributes["log.file.path"]
        regex: '/var/lib/docker/containers/(?P<container_id>[0-9a-f]{64})/.*'
        parse_to: resource

      # 2. Parse the outer Docker JSON.
      - type: json_parser
        id: docker_json_parser
        parse_from: body
        parse_to: body
        on_error: drop
        timestamp:
          parse_from: body.time
          layout: '%Y-%m-%dT%H:%M:%S.%fZ'
      
processors:
  transform:
    flatten_data: true
    log_statements:
      - error_mode: ignore
        statements:
          - 'set(resource.attributes["container.id"], resource.attributes["container_id"])'

  resourcedetection:
    detectors: [ "env", "docker", "ecs" ]
    timeout: 5s

  batch: {}

exporters:
  otlp:
    endpoint: "ingest.in.signoz.cloud:443"
    headers:
      signoz-ingestion-key: "$SIGNOZ_INGESTION_KEY"
    tls:
      insecure: false

service:
  extensions: [health_check]
  telemetry:
    logs:
      level: debug
  pipelines:
    traces:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp]

    metrics:
      receivers: [otlp]
      processors: [batch]
      exporters: [otlp]

    logs:
      receivers: [filelog]
      processors: [transform, resourcedetection, batch]
      exporters: [otlp]