-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add Counters & Logs for 404s and MapFallback #46404
Comments
What is this? How are these logs going to be consumed? |
Thanks for contacting us. We're moving this issue to the |
Triage feedback (@halter73): The counter can go directly into hosting, not the app builder, so we know what status code was actually sent to the client. Similarly, we can already use hosting's ResponseFinished log for this.
Hmm, using ResponseFinished doesn't account for the requirement about not logging paths if they're considered sensitive. Since it's hosting, would you do a counter for all responses with a status code dimension? There's only a few common ones (200, 301, 400, 401, 404, 500, etc.).
Submit this to the runtime/logging owners. |
I think we'd still want an info level log in the places indicated above, that covers our pattern of logging when we've taken decisive action on a request (e.g. produced a response, refused the request, etc.). The hosting level logs have a few drawbacks:
|
The customer reviewed this and said that the host metric is not sufficient for fallback routes. They also requested tweaks for missed routes.
Note, since the logs are debug and info respectively, and in specific categories, dotnet/runtime#82465 is not needed at this time. |
What does a missed route mean? Is it a route that failed to match? That's easily identifiable because the "route" tag value will be null. |
Missed in the sense that it reached the end of the pipeline without anything handling it. Other components won't have routes either like static files and auth callbacks. |
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
If a request reaches the end of the pipeline (e.g. isn't handled anywhere else) there is a default middleware that sends an empty 404 response.
aspnetcore/src/Http/Http/src/Builder/ApplicationBuilder.cs
Lines 138 to 141 in 0d52a44
Similarly MapFallback catches any request that didn't map to another route.
aspnetcore/src/Http/Routing/src/Builder/EndpointRouteBuilderExtensions.cs
Lines 388 to 391 in 0d52a44
Problem: There's no visibility in the system for tracking how many requests are missing routes and why. This information would be needed to identify bad links, misconfigured routes, and monitor the customer experience.
Describe the solution you'd like
Additional context
The counters would be used to monitor the volume of unexpected requests, and then the logs could be enabled to determine the specific request types.
Having sampling support in the loggers would also help deal with high volume output.
The text was updated successfully, but these errors were encountered: