Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fbreceiver] Default Processors are not being applied #42631

Open
khushijain21 opened this issue Feb 7, 2025 · 4 comments
Open

[fbreceiver] Default Processors are not being applied #42631

khushijain21 opened this issue Feb 7, 2025 · 4 comments
Assignees
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@khushijain21
Copy link
Contributor

When fbreceiver is created, it adds default processor to the settings here.

globalProcs, err := processors.NewPluginConfigFromList(defaultProcessors())

Expected:
It is expected that all documents ingested have host related fields added to it. According to this ref here https://www.elastic.co/guide/en/beats/filebeat/current/add-host-metadata.html

Got:
Except for host.name, no other fields are part of the ingested doc.

When we explicitly set the default processor in the config file. It correctly adds all host related fields.

How to test this locally

  1. cd x-pack/filebeat
  2. mage docker:composeUp
  3. Change filebeat-otel.yml to following config
filebeat.inputs:
  - type: filestream
    id: filestream-input-id
    enabled: true
    paths:
      - ./test.log

output:
  elasticsearch:
    hosts: ["http://localhost:9200"]
    username: admin
    password: testing

setup.kibana:
  host: http://localhost:5601
  username: admin
  password: testing
  1. Start filebeat in otel mode
./filebeat otel 

Check the document ingested

  1. Add processors and run with the same command again.
processors:
  - add_host_metadata:
      when:
        not:
          contains:
            tags: forwarded
  1. The host related parameters are correctly set
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label Feb 7, 2025
@khushijain21 khushijain21 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Feb 7, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Feb 7, 2025
@mauri870
Copy link
Member

mauri870 commented Feb 7, 2025

This is also happening for fbreceiver running as part of EDOT, in this test we add the processors manually otherwise the fields are not present.

@mauri870 mauri870 self-assigned this Feb 7, 2025
@mauri870
Copy link
Member

mauri870 commented Feb 7, 2025

I looked a bit into this and it seems that the call that instantiate the processors is:

settings.Processing = processing.MakeDefaultSupport(true, globalProcs, processing.WithECS, processing.WithHost, processing.WithAgentMeta())

However it only applies the processors if fleetmode.Enabled() is true, which is neither the case for EDOT nor filebeat otel:

if fleetmode.Enabled() && !beatCfg.HasField("processors") {
log.Debugf("In fleet mode with no processors specified, defaulting to global processors")
rawProcessors = fleetDefaultProcessors
} else {
rawProcessors = cfg.Processors
}

This results in none of the add_* processors being applied, the host.name field is only present because of processing.WithHost.

@mauri870
Copy link
Member

mauri870 commented Feb 7, 2025

I'm not entirely sure if this is a bug or just the default behavior.

cc @leehinman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

No branches or pull requests

3 participants