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

Migrate docker provider to ECS fields: container.image -> container.image.name #2411

Merged

Conversation

tetianakravchenko
Copy link
Contributor

What does this PR do?

Docker integration fails processing logs with the error:

object mapping for [container.image] tried to parse field [image] as object, but found a concrete value" 

in beats this field was migrated to the new ECS format a long time ago - add_docker_metadata elastic/beats#9412

Why is it important?

docker logs can't be processed, and event are dropped

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

Author's Checklist

  • [ ]

How to reproduce the error:

  1. Create the elastic cloud of version 8.8.0-SNAPSHOT
  2. run
sudo docker run --env FLEET_ENROLL=1 --env FLEET_URL=<URL>  --env FLEET_ENROLLMENT_TOKEN=<TOKEN> --user=root --volume="/var/run/docker.sock:/var/run/docker.sock:ro" --volume="/:/docker:ro" --rm docker.elastic.co/beats/elastic-agent:8.8.0-SNAPSHOT

-> see the error {\"type\":\"mapper_parsing_exception\",\"reason\":\"object mapping for [container.image] tried to parse field [image] as object, but found a concrete value\"}, dropping event!"

How to test this PR locally

  1. DEV=true PLATFORMS=linux/amd64 PACKAGES=docker mage package
  2. cd build/package/elastic-agent/elastic-agent-linux-amd64.docker/docker-build
  3. docker build -t custom-elastic-agent-docker-logs-parsing-6 .
sudo docker run --env FLEET_ENROLL=1 --env FLEET_URL=<URL> --env FLEET_ENROLLMENT_TOKEN=<TOKEN> --user=root --volume="/var/run/docker.sock:/var/run/docker.sock:ro" --volume="/:/docker:ro" --rm custom-elastic-agent-docker-logs-parsing-6:latest

result:
logs are parsed, container.image.name field is available:
Screenshot 2023-03-28 at 19 07 04

Related issues

Use cases

Screenshots

Logs

…mage.name

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
@tetianakravchenko tetianakravchenko added the bug Something isn't working label Mar 28, 2023
@tetianakravchenko tetianakravchenko requested a review from a team as a code owner March 28, 2023 17:25
@tetianakravchenko tetianakravchenko requested review from AndersonQ, blakerouse, a team, gsantoro and devamanv and removed request for a team March 28, 2023 17:25
@mergify
Copy link
Contributor

mergify bot commented Mar 28, 2023

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

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

NOTE: backport-skip has been added to this pull request.

@tetianakravchenko tetianakravchenko added backport-v8.6.0 Automated backport with mergify backport-v8.7.0 Automated backport with mergify Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team labels Mar 28, 2023
@mergify mergify bot removed the backport-skip label Mar 28, 2023
@elasticmachine
Copy link
Contributor

elasticmachine commented Mar 28, 2023

💚 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: 2023-03-29T10:13:03.076+0000

  • Duration: 19 min 58 sec

Test stats 🧪

Test Results
Failed 0
Passed 5247
Skipped 23
Total 5270

💚 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.

  • run integration tests : Run the Elastic Agent Integration tests.

  • run end-to-end tests : Generate the packages and run the E2E Tests.

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

@elasticmachine
Copy link
Contributor

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 98.438% (63/64) 👍
Files 69.863% (153/219) 👍
Classes 68.523% (283/413) 👍
Methods 53.96% (872/1616) 👍
Lines 39.203% (9714/24779) 👎 -0.023
Conditionals 100.0% (0/0) 💚

@tetianakravchenko tetianakravchenko merged commit 3d73887 into elastic:main Mar 29, 2023
mergify bot pushed a commit that referenced this pull request Mar 29, 2023
…mage.name (#2411)

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 3d73887)
mergify bot pushed a commit that referenced this pull request Mar 29, 2023
…mage.name (#2411)

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 3d73887)
tetianakravchenko added a commit that referenced this pull request Mar 29, 2023
…mage.name (#2411) (#2412)

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 3d73887)

Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
tetianakravchenko added a commit that referenced this pull request Mar 29, 2023
…mage.name (#2411) (#2413)

Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
(cherry picked from commit 3d73887)

Co-authored-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-v8.6.0 Automated backport with mergify backport-v8.7.0 Automated backport with mergify bug Something isn't working Team:Cloudnative-Monitoring Label for the Cloud Native Monitoring team
Projects
None yet
4 participants