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

Beats do not log to stderr when running in a container or systemd environment #41118

Closed
belimawr opened this issue Oct 4, 2024 · 5 comments · Fixed by elastic/elastic-agent-libs#236 or #41186
Assignees
Labels
bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Comments

@belimawr
Copy link
Contributor

belimawr commented Oct 4, 2024

For confirmed bugs, please report:

Reproducing with Docker:

docker run --rm docker.elastic.co/beats/filebeat:8.14.3

Will log to stderr

docker run --rm docker.elastic.co/beats/filebeat:8.15.2

Will produce no logs on stderr.

When using -environment systemd this issue can also be observed.

Workaround

Pass the -e flag when running the Beat or add logging.to_stderr: true to your configuration file.

@belimawr belimawr added bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Oct 4, 2024
@elasticmachine
Copy link
Collaborator

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

belimawr added a commit to belimawr/beats that referenced this issue Oct 4, 2024
Add a known issue entry for 8.15.0 and 8.15.2 referencing
elastic#41118.
belimawr added a commit to belimawr/beats that referenced this issue Oct 4, 2024
Add a known issue entry for 8.15.0 and 8.15.2 referencing
elastic#41118.
pierrehilbert pushed a commit that referenced this issue Oct 4, 2024
Add a known issue entry for 8.15.0 and 8.15.2 referencing
#41118.
mergify bot pushed a commit that referenced this issue Oct 4, 2024
Add a known issue entry for 8.15.0 and 8.15.2 referencing
#41118.

(cherry picked from commit 9d87afa)

# Conflicts:
#	CHANGELOG.asciidoc
mergify bot pushed a commit that referenced this issue Oct 4, 2024
Add a known issue entry for 8.15.0 and 8.15.2 referencing
#41118.

(cherry picked from commit 9d87afa)

# Conflicts:
#	CHANGELOG.asciidoc
@mauri870
Copy link
Member

mauri870 commented Oct 4, 2024

@belimawr I'm confused, isn't this behaving as expected according to #38767?

  1. Look at the logs (container) and assert no event data is going to stderr:

If you want to see the event logs going to stderr, uncomment the following lines from the configuration:

     # "-E",
     # "logging.event_data.to_stderr=true"

Edit: In a call with Tiago it is clear that this was not supposed to affect the container behavior.

@mauri870
Copy link
Member

mauri870 commented Oct 7, 2024

This seems to be a bug introduced in elastic/elastic-agent-libs#208, the default location for container logs was silently changed to files instead of stderr. It should be fixed by elastic/elastic-agent-libs#236.

@mauri870
Copy link
Member

mauri870 commented Oct 9, 2024

Reopening as we need to track the PRs updating the lib in Beats as well as backport PRs.

@mauri870 mauri870 changed the title Beats do not log to stderr when running in a container (our docker images) or when -environment container is set. Beats do not log to stderr when running in a container or systemd environment Oct 9, 2024
@mauri870
Copy link
Member

mauri870 commented Oct 9, 2024

FYI I updated this ticket to mention that -environment systemd is also affected.

mergify bot pushed a commit that referenced this issue Oct 10, 2024
This PR updates elastic-agent-libs to the latest version in order to fix #41118.

(cherry picked from commit f369a28)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum
mergify bot pushed a commit that referenced this issue Oct 10, 2024
This PR updates elastic-agent-libs to the latest version in order to fix #41118.

(cherry picked from commit f369a28)
pierrehilbert pushed a commit that referenced this issue Oct 11, 2024
…nts (#41194)

This PR updates elastic-agent-libs to the latest version in order to fix #41118.

(cherry picked from commit f369a28)

Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
mauri870 added a commit that referenced this issue Oct 11, 2024
…er or systemd environments (#41193)

* fix: restore stderr logs when running on docker or systemd environments

This PR updates elastic-agent-libs to the latest version in order to fix #41118.

(cherry picked from commit f369a28)

# Conflicts:
#	NOTICE.txt
#	go.mod
#	go.sum

* fix conflicts

---------

Co-authored-by: Mauri de Souza Meneguzzo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team
Projects
None yet
3 participants