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

Fix docker provider add_fields processors #33269

Merged
merged 1 commit into from
Oct 13, 2022

Conversation

belimawr
Copy link
Contributor

@belimawr belimawr commented Oct 6, 2022

This is a backport PR for: elastic/elastic-agent#1420

What does this PR do?

The Docker provider was using a wrong key when defining the add_fields processor, this causes Filebeat not to start the input and stay on a unhealthy state. This processor seems to be defined every time a variable like ${docker} is used on a input configuration.

This commit fixes it.

Why is it important?

It fixes a bug on Docker auto discovery provider

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.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Author's Checklist

  • Decide about backports (7.17?)
  • Backport to 7.17.x (PR on Beats repo)

How to test this PR locally

  1. Make sure you have Docker installed and running
  2. Deploy Elastic Stack
  3. Start a container that will generate logs (e.g: docker run --rm --name flog -d mingrammer/flog /bin/flog -s1 -d1 -l -f rfc3164).
  4. Create a standalone Elastic-Agent policy using Kibana as suggested in the documentation.
  5. On this policy add the "Custom Logs Integration" configuring the path as /var/lib/docker/containers/${docker.container.id}/*-json.log.
  6. Download the policy (e.g: /tmp/elastic-agent.yml), adjust the Elasticsearch credentials as needed.
  7. Start the Elastic-Agent with log debug (running as root is usually required to read /var/lib/docker/*):
    sudo elastic-agent  -e -d "*"
    
  8. You should see logs on Kibana

Related issues

## Use cases
## Screenshots
## Logs

@belimawr belimawr added bug Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team labels Oct 6, 2022
@belimawr belimawr requested a review from a team as a code owner October 6, 2022 09:45
@belimawr belimawr requested review from aleksmaus and michalpristas and removed request for a team October 6, 2022 09:45
@elasticmachine
Copy link
Collaborator

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

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Oct 6, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Oct 6, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-10-11T09:19:10.776+0000

  • Duration: 110 min 24 sec

Test stats 🧪

Test Results
Failed 0
Passed 6209
Skipped 394
Total 6603

💚 Flaky test report

Tests succeeded.

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /package : Generate the packages and run the E2E tests.

  • /beats-tester : Run the installation tests with beats-tester.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

@belimawr
Copy link
Contributor Author

belimawr commented Oct 6, 2022

/package

@belimawr
Copy link
Contributor Author

belimawr commented Oct 6, 2022

/test

2 similar comments
@belimawr
Copy link
Contributor Author

belimawr commented Oct 6, 2022

/test

@belimawr
Copy link
Contributor Author

/test

The Docker provider was using a wrong key when defining the
`add_fields` processor, this causes Filebeat not to start the input
and stay on a unhealthy state. This processor seems to be defined
every time a variable like `${docker}` is used on a input
configuration.

This commig fixes it.
@belimawr
Copy link
Contributor Author

I'll merge this because only the e2e tests are failing and they're know to be flaky.

@belimawr belimawr merged commit 7f590eb into elastic:7.17 Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 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.

3 participants