Skip to content

[8.18](backport #7995) Enable Filebeat's Journald input in some docker image variants #8482

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

Merged
merged 9 commits into from
Jun 18, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 12, 2025

What does this PR do?

Filebeat's Journald input requires journalctl, so the systemd package is added to all docker image variants.

Changes in image size

Images built from main (f108618):

docker.elastic.co/elastic-agent/elastic-agent-complete         9.1.0-SNAPSHOT         123d3a5d0a22   2 hours ago   3.57GB
docker.elastic.co/elastic-agent/elastic-otel-collector         9.1.0-SNAPSHOT         a5182ef34ae0   2 hours ago   1.2GB
docker.elastic.co/elastic-agent/elastic-agent                  9.1.0-SNAPSHOT         cf9309afdc3f   2 hours ago   1.89GB

Images built from this PR:

docker.elastic.co/elastic-agent/elastic-agent-complete         9.1.0-SNAPSHOT         18845462f221   16 minutes ago   3.58GB
docker.elastic.co/elastic-agent/elastic-otel-collector         9.1.0-SNAPSHOT         2f29d6c0f17a   18 minutes ago   1.25GB
docker.elastic.co/elastic-agent/elastic-agent                  9.1.0-SNAPSHOT         d5b99148748a   18 minutes ago   1.94GB

Increase in size

  • docker.elastic.co/elastic-agent/elastic-agent-complete: 10MB
  • docker.elastic.co/elastic-agent/elastic-otel-collector: 50MB
  • docker.elastic.co/elastic-agent/elastic-agent: 40MB

Why is it important?

Currently it is only possible to use integrations that requires the journald input with the complete docker image variant, this PR allows it to be used with any docker image variant. The complete docker image is the largest with more than 3Gb, while the standard Elastic-Agent image is less than 2Gb.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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

Author's Checklist

  • Add integration test for each docker image: mount the journal into the container and ensure the Journald input can read it.

How to test this PR locally

  1. Package the Elastic-Agent:
    DEV=true SNAPSHOT=true EXTERNAL=true PACKAGES="docker" PLATFORMS=linux/amd64 mage -v package
    
  2. Check the version of journalctl on each docker image by running the following script/commands:
    #!/bin/bash
    
    echo "############################## Testing images with journalctl ##############################"
    
    set -o xtrace
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-complete:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-ubi:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-otel-collector:9.1.0-SNAPSHOT  --version
    
    set +o xtrace
    echo "############################## Testing images without journalctl ##############################"
    
    set -o xtrace
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-complete-wolfi:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-slim-wolfi:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-slim:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-agent-wolfi:9.1.0-SNAPSHOT  --version
    docker run --rm -it --entrypoint journalctl docker.elastic.co/elastic-agent/elastic-otel-collector-wolfi:9.1.0-SNAPSHOT  --version
    
  3. Alternatively, check the Dockerfile for each of the images:
    grep "systemd" build/package/elastic-*/*/docker-build/Dockerfile

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?
  • ...

This is an automatic backport of pull request #7995 done by [Mergify](https://mergify.com).

Filebeat's Journald input requires `journalctl`, so the systemd
package is added to elastic-agent, elastic-agent-complete, elastic-otel-collector variants.

---------

Co-authored-by: Craig MacKenzie <craig.mackenzie@elastic.co>
(cherry picked from commit fd33d85)

# Conflicts:
#	dev-tools/packaging/settings.go
#	dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl
@mergify mergify bot added the backport label Jun 12, 2025
@mergify mergify bot requested a review from a team as a code owner June 12, 2025 23:06
@mergify mergify bot added the conflicts There is a conflict in the backported pull request label Jun 12, 2025
@mergify mergify bot requested review from michalpristas and swiatekm and removed request for a team June 12, 2025 23:06
@mergify mergify bot added the conflicts There is a conflict in the backported pull request label Jun 12, 2025
Copy link
Contributor Author

mergify bot commented Jun 12, 2025

Cherry-pick of fd33d85 has failed:

On branch mergify/bp/8.18/pr-7995
Your branch is up to date with 'origin/8.18'.

You are currently cherry-picking commit fd33d8569.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	new file:   changelog/fragments/1745609163-journalctl-on-all-docker-variants.yaml
	modified:   magefile.go
	new file:   testing/integration/journald_test.go
	modified:   testing/integration/kubernetes_agent_standalone_test.go
	new file:   testing/integration/testdata/journald-input.yml
	new file:   testing/integration/testdata/journald-otel.yml

Unmerged paths:
  (use "git add/rm <file>..." as appropriate to mark resolution)
	deleted by us:   dev-tools/packaging/settings.go
	both modified:   dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@mergify mergify bot added the backport label Jun 12, 2025
@github-actions github-actions bot added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Jun 12, 2025
@elasticmachine
Copy link
Collaborator

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

@elasticmachine
Copy link
Collaborator

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

Mostly re-doing the addition of systemd packages due to the different
base images
Copy link
Contributor Author

mergify bot commented Jun 16, 2025

This pull request has not been merged yet. Could you please review and merge it @belimawr? 🙏

@pkoutsovasilis
Copy link
Contributor

sorry @belimawr I hope that you don't mind but I am taking over this PR, I am anticipating a large k8s fix that needs to come and I need this one merged 🙂

The first reason that I see these tests failing is because of this #8452

@pkoutsovasilis
Copy link
Contributor

pkoutsovasilis commented Jun 18, 2025

ok the ugprade failures are known and being handled in the beats repo. but @belimawr have a look at the changes I did and merge it if you are ok 🙂

@belimawr
Copy link
Contributor

sorry @belimawr I hope that you don't mind but I am taking over this PR, I am anticipating a large k8s fix that needs to come and I need this one merged 🙂

The first reason that I see these tests failing is because of this #8452

Be my guest :D. Thanks for the help!

I had seen #8452, hence I was considering this PR blocked until it was solved, I should have linked it here. Sorry for that.

@belimawr belimawr assigned pkoutsovasilis and unassigned belimawr Jun 18, 2025
@belimawr
Copy link
Contributor

I removed myself from the assignee list, but feel free to ping me if you need anything.

@pkoutsovasilis
Copy link
Contributor

@belimawr please tell me that I didn't remove anything critical with these two commits 4d4c251 968f123 🙂

@belimawr
Copy link
Contributor

@belimawr please tell me that I didn't remove anything critical with these two commits 4d4c251 968f123 🙂

All good!

belimawr
belimawr previously approved these changes Jun 18, 2025
Copy link

@elasticmachine
Copy link
Collaborator

elasticmachine commented Jun 18, 2025

@pkoutsovasilis pkoutsovasilis merged commit 8337980 into 8.18 Jun 18, 2025
18 checks passed
@pkoutsovasilis pkoutsovasilis deleted the mergify/bp/8.18/pr-7995 branch June 18, 2025 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport conflicts There is a conflict in the backported pull request Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants