-
Notifications
You must be signed in to change notification settings - Fork 848
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
Proxy supplies logs with relevant info for each stage of the request #660
Comments
Triage: We need to check that we are logging useful info about request progress and failures in YARP (E2E). |
How can I enable logging on the yarp, I added this code but nothing happens. services.AddLogging(builder => builder
.AddConsole().AddDebug()
);
services.AddReverseProxy()
.LoadFromConfig(Configuration.GetSection("ReverseProxy"));
services.AddTelemetryListeners(); |
Sorry @Tratcher I didn't explain my point, this code returns me my log endpoints.MapReverseProxy(proxyPipeline =>
{
proxyPipeline.Use(async (context, next) =>
{
var provider = context.RequestServices;
var logger = provider.GetService<ILogger<Startup>>();
logger.Log(LogLevel.Information, "TEST"); But I couldn't make the log from the requests on the other server to be logged, I have an error 500 in the proxy that I can't reproduce, and I would like to see all of the information that is going and coming back to find ot what is going on this request. Thanks for the help |
@MihaZupan plans to write docs about Telemetry in #676. The linked consumption sample may help? |
This comment has been minimized.
This comment has been minimized.
@luizfbicalho if you have troubles with specific case, let's move it to separate issue. This is User Story describing the general capability, not troubleshooting specific bugs / shortcomings. |
The log |
Triage: We need to test few important scenarios and review what we log from them. |
With the output included in the default console log, and the samples for more detailed telemetry and metrics, IMHO we have this covered. |
@samsp-msft please run a few error scenarios and see if you get the logs you expect. |
Playing with this a bit more, I think in the default log we could be including more information about the destination request/response.
What I could be considered missing is the destination IP, protocol version, protocol version policy. The following should not change from the request: method, content size I suspect the main question is who needs the data and when? For general purpose logging - its probably sufficient. However in the case that there is a problem, and the user is trying to determine what has gone wrong then its probably insufficient. In those cases having log entries that detail the request and response header stats would be useful. Ideally this would be a feature included in the proxy that can be turned on and off via configuration (which enables commandline and env variables) and possibly through a request header. It could be delivered via a sample, but seems like it would be better to be baked in as a standard module. It really needs to run after the transforms so is not readily insertable by the user. |
The destination IP isn't available at the YARP layer, that's managed internally by SocketsHttpHandler. The requested protocol version and policy make sense to add.
.NET 6 has a new logging middleware for this. Give it a try? |
Now that the filtering list has been updated, the logging middleware has sufficient data. I am going to change this to a doc topic. |
Opening a new issue as discussion in #115 was unrelated.
The text was updated successfully, but these errors were encountered: