-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[HTTP] Add more info to the log.error metadata #169552
[HTTP] Add more info to the log.error metadata #169552
Conversation
Pinging @elastic/kibana-core (Team:Core) |
@@ -217,7 +217,11 @@ export class Router<Context extends RequestHandlerContextBase = RequestHandlerCo | |||
// forward 401 errors from ES client | |||
if (isElasticsearchUnauthorizedError(error)) { | |||
this.log.error(`401 Unauthorized`, { | |||
http: { response: { status_code: 401 } }, | |||
http: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can enrich the error logged on line 203 too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on green! 🚀
💛 Build succeeded, but was flaky
Failed CI StepsMetrics [docs]
History
To update your PR or re-run it, just comment with: cc @afharo |
Summary
Adding a few fields to the ECS metadata in the HTTP error logs:
error.message
: cherry-picking the error message only to avoid unintended leak of information if the error contains too much info in its propertiesrequest.method
andrequest.path
: so that we know to which handler the error is scoped. Note that the path is the registered path (with variable templates), not the final pathThe reason: we need to be able to have a hint of what's the error behind a blind
[ERROR][http] 500 Server Error
.For maintainers