Skip to content

[receiver/filelog] containerd operator fails on windows hosts #35558

Closed
@squ1d123

Description

@squ1d123

Component(s)

receiver/filelog

What happened?

Description

The containerd operator whithin the filelog reciever fails to generate attributes on Windows hosts.

This looks to be because the regex parsing does not cater for windows file path seperator.

Steps to Reproduce

  1. Running on AWS EKS cluster with a windows node
  2. Deploy OpenTelemetryCollector CRD with below config
apiversion: opentelemetry.io/v1beta1
kind: opentelemetrycollector
metadata:
  name: otel-windows
  namespace: olly-system
spec:
  config:
    exporters:
      debug:
        verbosity: detailed
    processors:
      batch/logs:
        send_batch_max_size: 5000
        send_batch_size: 2500
        timeout: 10s
    receivers:
      filelog:
        include:
        - c:\var\log\pods\*\*\*.log
        include_file_name: false
        include_file_path: true
        include_file_record_number: true
        operators:
        - add_metadata_from_filepath: true
          format: containerd
          type: container
        retry_on_failure:
          enabled: true
          initial_interval: 1s
          max_elapsed_time: 10m
          max_interval: 30s
        start_at: beginning
        storage: file_storage
    service:
      pipelines:
        logs:
          exporters:
          - debug
          processors:
          - batch/logs
          receivers:
          - filelog
      telemetry:
        logs:
          level: debug
  nodeselector:
    kubernetes.io/os: windows

Expected Result

Collector to parse the log and add attributes.

  • k8s.pod.name
  • k8s.pod.uid
  • k8s.container.name
  • k8s.container.restart_count
  • k8s.namespace.name

Actual Result

Receive error

2024-10-01T14:57:41.620+0100    error   reader/reader.go:140    process: %w     {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "C:\\var\\log\\pods\\my-namespace_some-pod-lksd23el3_041f33f9-34ac-4b6a-8df9-68dc27f4bd27\\main\\0.log", "error": "failed to handle attribute mappings: failed to detect a valid log path"}

Collector version

v0.110.0

Environment information

Environment

OS: Windows EKS Node

OpenTelemetry Collector configuration

exporters:
  debug:
    verbosity: detailed
processors:
  batch/logs:
    send_batch_max_size: 5000
    send_batch_size: 2500
    timeout: 10s
receivers:
  filelog:
    include:
    - c:\var\log\pods\*\*\*.log
    include_file_name: false
    include_file_path: true
    include_file_record_number: true
    operators:
    - add_metadata_from_filepath: true
      format: containerd
      type: container
    retry_on_failure:
      enabled: true
      initial_interval: 1s
      max_elapsed_time: 10m
      max_interval: 30s
    start_at: beginning
    storage: file_storage
service:
  pipelines:
    logs:
      exporters:
      - debug
      processors:
      - batch/logs
      receivers:
      - filelog
  telemetry:
    logs:
      level: debug

Log output

2024-10-01T14:57:41.620+0100    error   reader/reader.go:140    process: %w     {"kind": "receiver", "name": "filelog", "data_type": "logs", "component": "fileconsumer", "path": "C:\\var\\log\\pods\\my-namespace_some-pod-lksd23el3_041f33f9-34ac-4b6a-8df9-68dc27f4bd27\\main\\0.log", "error": "failed to handle attribute mappings: failed to detect a valid log path"}

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