Skip to content

otel: trim non-otel configuration from when validating the otel configuration #6235

@mauri870

Description

@mauri870

Now with the groundwork for the hybrid agent done in #5796 it is possible to have a yaml config file with both beats and otel configuration, for example:

hybrid-agent-config.yml
# normal agent config
filebeat.inputs:
  - type: filestream
    id: filestream-filebeat
    enabled: true
    paths:
      - /tmp/filebeat.log
output.elasticsearch:
  hosts:
    - https://esendpoint
  api_key: api-key
  index: filebeat-index
# and otel config on the same file
receivers:
  filebeatreceiver:
    filebeat:
      inputs:
        - type: filestream
          id: filestream-fbreceiver
          enabled: true
          paths:
            - /tmp/fbreceiver.log
    output:
      otelconsumer:
    logging:
      level: info
      selectors:
        - '*'
    path.home: /tmp
    queue.mem.flush.timeout: 0s
exporters:
  elasticsearch/log:
    endpoints:
      - https://esendpoint
    api_key: api-key
    logs_index: fbreceiver-index
    batcher:
      enabled: true
      flush_timeout: 1s
    mapping:
      mode: bodymap
service:
  pipelines:
    logs:
      receivers:
        - filebeatreceiver
      exporters:
        - elasticsearch/log

When running ./elastic-agent otel validate --config=./hybrid-agent-config.yml I get the following error:

failed to get config: cannot unmarshal the configuration: decoding failed due to the following error(s):

'' has invalid keys: filebeat.inputs, output.elasticsearch

When validating this file, we need to remove any top-level Beats-specific configuration to ensure that only the OpenTelemetry-specific components are validated.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions