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

Cherry-pick #14706 to 7.x: Fix and extend logging of light modules load errors #16775

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Mar 3, 2020

Cherry-pick of PR #14706 to 7.x branch. Original message:

Two things are solved here:

  • Errors were being logged with logp.Error that doesn't actually log anything, use a local logger and its Errorf method instead.
  • Log errors also when listing modules for string representation.

This was hiding errors, what was specially confusing when permissions are not correct during development and testing, now errors like this one are logged if permissions are not correct:

2019-11-22T12:03:51.398+0100	ERROR	mb/lightmodules.go:107	failed to load module config for module 'cockroachdb': failed to load module configuration from '/home/jaime/gocode/src/github.com/elastic/beats/x-pack/metricbeat/module/cockroachdb/module.yml': config file ("/home/jaime/gocode/src/github.com/elastic/beats/x-pack/metricbeat/module/cockroachdb/module.yml") can only be writable by the owner but the permissions are "-rw-rw-r--" (to fix the permissions use: 'chmod go-w /home/jaime/gocode/src/github.com/elastic/beats/x-pack/metricbeat/module/cockroachdb/module.yml')

Some errors have been rephrased so logged errors start with uppercase, and "failed to" is not logged in all nested errors.

@jsoriano jsoriano requested a review from a team as a code owner March 3, 2020 20:38
@jsoriano jsoriano force-pushed the backport_14706_7.x branch from eba382d to 334936c Compare March 3, 2020 20:39
Two things are solved here:

* Errors were being logged with logp.Error that doesn't actually log
  anything, use a local logger and its Errorf method instead.
* Log errors also when listing modules for string representation.

This was hiding errors, what was specially confusing when permissions
are not correct during development and testing, now errors are logged
if permissions are not correct.

Some errors have been rephrased so logged errors start with uppercase,
and "failed to" is not logged in all nested errors.

(cherry picked from commit 10da237)
@jsoriano jsoriano force-pushed the backport_14706_7.x branch from 334936c to ceaa3ef Compare March 3, 2020 20:40
@jsoriano jsoriano merged commit 742a7fd into elastic:7.x Mar 4, 2020
@jsoriano jsoriano deleted the backport_14706_7.x branch March 4, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants