Skip to content

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

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 4 commits into from
Jun 17, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 13, 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 <[email protected]>
(cherry picked from commit fd33d85)

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

mergify bot commented Jun 13, 2025

Cherry-pick of fd33d85 has failed:

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

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:   dev-tools/packaging/settings.go
	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 <file>..." to mark resolution)
	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

@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 13, 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)

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? 🙏

belimawr added 3 commits June 16, 2025 11:50
Fix merge conflicts dues to the different base images and variants,
remove the Otel-Collector tests because this variant does not exist in
8.19.
Copy link

@elasticmachine
Copy link
Collaborator

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @belimawr

@belimawr belimawr merged commit 191c642 into 8.19 Jun 17, 2025
19 checks passed
@belimawr belimawr deleted the mergify/bp/8.19/pr-7995 branch June 17, 2025 12:23
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.

2 participants