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

Logger from the standard library is not correctly disabled. #10251

Closed
ph opened this issue Jan 22, 2019 · 2 comments · Fixed by #15708
Closed

Logger from the standard library is not correctly disabled. #10251

ph opened this issue Jan 22, 2019 · 2 comments · Fixed by #15708
Assignees
Labels
bug good first issue Indicates a good issue for first-time contributors libbeat Team:Integrations Label for the Integrations team

Comments

@ph
Copy link
Contributor

ph commented Jan 22, 2019

I've seen a report where a keep alive TCP connection received some garbage from the remote end, since we didn't have anything configured to handle that request the http client did just log the error directly using the default logger. Since beats was running as a service the log went to stdout/stderr and was dump to the /var/log/message, This is indeed an unexpected behavior.

The following code is not exactly what it need to be. We have to setup ioutil.Discard when the catch all selector * is not set or stdlog is not set. When either of the selector is defined we need to use our logger output.

beats/libbeat/logp/core.go

Lines 101 to 105 in 4cb9bd7

if _, enabled := selectors["stdlog"]; !enabled {
// Disable standard logging by default (this is sometimes used by
// libraries and we don't want their spam).
golog.SetOutput(ioutil.Discard)
}

@urso urso added good first issue Indicates a good issue for first-time contributors Team:Beats labels Jan 3, 2020
@urso
Copy link

urso commented Jan 3, 2020

@ph Any idea if the problem still exists?

@ph
Copy link
Contributor Author

ph commented Jan 3, 2020

double checked the code, this is still an issue but a good first issue.

@blakerouse blakerouse self-assigned this Jan 17, 2020
blakerouse added a commit to blakerouse/beats that referenced this issue Jan 24, 2020
blakerouse added a commit that referenced this issue Jan 27, 2020
…tdout is selected. (#15708)

* Disable default logger when stdlog or the default all selector is not enabled.

* Fix issue where default go logger is not discarded when either * or stdout is selected. Fix #10251.

* Change logic to always discard unless in debug and when all or stdlog is selected. Add more tests.

* Fix comments.

* Add changelog entry.
blakerouse added a commit to blakerouse/beats that referenced this issue Jan 27, 2020
…tdout is selected. (elastic#15707)

* Disable default logger when stdlog or the default all selector is not enabled.

* Fix issue where default go logger is not discarded when either * or stdout is selected. Fix elastic#10251.

* Change logic to always discard unless in debug and when all or stdlog is selected. Add more tests.

* Fix comments.

* Add changelog entry.

(cherry picked from commit 1838734)
blakerouse added a commit that referenced this issue Jan 28, 2020
…tdout is selected. (#15707) (#15880)

* Disable default logger when stdlog or the default all selector is not enabled.

* Fix issue where default go logger is not discarded when either * or stdout is selected. Fix #10251.

* Change logic to always discard unless in debug and when all or stdlog is selected. Add more tests.

* Fix comments.

* Add changelog entry.

(cherry picked from commit 1838734)

Co-authored-by: kaiyan-sheng <kaiyan.sheng@elastic.co>
@andresrc andresrc added the Team:Integrations Label for the Integrations team label Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Indicates a good issue for first-time contributors libbeat Team:Integrations Label for the Integrations team
Projects
None yet
4 participants