Skip to content

Use structured log properties in HTTP logging middleware #33038

Closed
@ThomasArdal

Description

@ThomasArdal

The new HTTP logging middleware is a neat idea. IMO it's not really usable for anything else than simple console or file logging, though. This is because all of the information from the request and response is simply concatenated to a big string:

Request: Protocol: HTTP/2 Method: GET Scheme: https PathBase: Path: /serviceworker.js QueryString: Cache-Control: [Redacted] :authority: [Redacted] :method: [Redacted] :path: [Redacted] :scheme: [Redacted] Accept: */* Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9,da;q=0.8,da-DK;q=0.7 Cookie: [Redacted] Host: localhost:5001 Referer: [Redacted] User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 service-worker: [Redacted] sec-fetch-site: [Redacted] sec-fetch-mode: [Redacted] sec-fetch-dest: [Redacted]

The string is fine, but including structured properties would make it possible to do lots of interesting things if working with a log storage implementation that supports structured properties. The above string could look like this structured:

Request: {Protocol} {Method} {Scheme} {PathBase} {Path} {QueryString} ...

Metadata

Metadata

Assignees

Labels

area-networkingIncludes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractionsbugThis issue describes a behavior which is not expected - a bug.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions