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

Add filebeat receiver to otel mode #5833

Merged
merged 1 commit into from
Oct 30, 2024
Merged

Conversation

leehinman
Copy link
Contributor

@leehinman leehinman commented Oct 22, 2024

What does this PR do?

Adds filebeat receiver as an otel receiver. This is a re-introduction of code that was added in #5672, that had to be reverted because the import of the beats code base was causing issues with command line parsing. The issues in the beats code base have been fixed, so we are re-introducing this change.

Why is it important?

This is the first beat receiver, and this will allow us to test the feasibility of running beats as otel receivers.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

should be 0 user impact of existing configurations

How to test this PR locally

Use something like the following as otel.yml, and run elastic-agent otel --config otel.yml
This will run the beat receiver, which will produce one event.
The event should be written to the path you specify in the file/no_rotation section.

receivers:
  filebeatreceiver:
    filebeat:
      inputs:
        - type: benchmark
          enabled: true
          count: 1
          message: "The quick brown fox jumped over the lazy dog"
    output:
      otelconsumer:
    logging:
      level: info
      selectors:
        - '*'
    path:
      home: /tmp/<state dir>
exporters:
  file/no_rotation:
    path: /tmp/<output file>
service:
  pipelines:
    logs:
      receivers: [filebeatreceiver]
      exporters: [file/no_rotation]

Related issues

Questions to ask yourself

  • How are we going to support this in production?
  • How are we going to measure its adoption?
  • How are we going to debug this?
  • What are the metrics I should take care of?
  • ...

@leehinman leehinman requested a review from a team as a code owner October 22, 2024 21:08
@leehinman leehinman requested review from kaanyalti and pchila October 22, 2024 21:08
Copy link
Contributor

mergify bot commented Oct 22, 2024

This pull request does not have a backport label. Could you fix it @leehinman? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label to automatically backport to the 8./d branch. /d is the digit

Copy link
Contributor

mergify bot commented Oct 22, 2024

backport-v8.x has been added to help with the transition to the new branch 8.x.
If you don't need it please use backport-skip label and remove the backport-8.x label.

@mergify mergify bot added the backport-8.x Automated backport to the 8.x branch with mergify label Oct 22, 2024
@ycombinator ycombinator added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Oct 22, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

@ycombinator ycombinator requested review from blakerouse, rdner and mauri870 and removed request for kaanyalti and pchila October 22, 2024 23:46
Copy link
Contributor

mergify bot commented Oct 23, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 41277_testing upstream/41277_testing
git merge upstream/main
git push upstream 41277_testing

@mauri870
Copy link
Member

@leehinman FYI I edited your PR description to fix the otel config.

Copy link
Member

@mauri870 mauri870 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, tested locally and was able to run the filebeat receiver and confirm the data is properly exported to the file output.

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited to see this back! Looks good.

@jlind23
Copy link
Contributor

jlind23 commented Oct 24, 2024

The error we got in CI is:

Status: Downloaded newer image for docker.elastic.co/beats-dev/golang-crossbuild:1.22.8-main
  | >> Building using: cmd='build/mage-linux-amd64 golangCrossBuild', env=[CC=x86_64-w64-mingw32-gcc, CXX=x86_64-w64-mingw32-g++, GOARCH=amd64, GOARM=, GOOS=windows, PLATFORM_ID=windows-amd64]
  | # github.com/elastic/elastic-agent
  | /usr/local/go/pkg/tool/linux_amd64/link: running aarch64-linux-gnu-gcc failed: exit status 1
  | /usr/lib/gcc-cross/aarch64-linux-gnu/6/../../../../aarch64-linux-gnu/bin/ld.gold: internal error in maybe_apply_stub, at ../../gold/aarch64.cc:5407
  | collect2: error: ld returned 1 exit status

Which looks similar to - elastic/beats#41270

Copy link
Contributor

mergify bot commented Oct 25, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b 41277_testing upstream/41277_testing
git merge upstream/main
git push upstream 41277_testing

@leehinman leehinman force-pushed the 41277_testing branch 2 times, most recently from 1e4d44a to f97630f Compare October 28, 2024 15:06
@mauri870
Copy link
Member

Triggered another test run. Let's see if the build succeeds this time around.

@mauri870
Copy link
Member

@rdner Looks like this is missing an approval from you, would you mind taking a look? Thanks.

@leehinman leehinman enabled auto-merge (squash) October 30, 2024 14:48
@leehinman leehinman merged commit 89dca1d into elastic:main Oct 30, 2024
14 checks passed
mergify bot pushed a commit that referenced this pull request Oct 30, 2024
(cherry picked from commit 89dca1d)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
@flexitrev
Copy link

This is amazing!

leehinman added a commit that referenced this pull request Nov 8, 2024
(cherry picked from commit 89dca1d)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
leehinman added a commit that referenced this pull request Nov 9, 2024
* Add filebeat receiver to otel mode (#5833)



Co-authored-by: Lee E Hinman <[email protected]>
Co-authored-by: Lee E. Hinman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8.x Automated backport to the 8.x branch with mergify Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants