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

Add some request headers to the log #215

Closed
wants to merge 2 commits into from
Closed

Add some request headers to the log #215

wants to merge 2 commits into from

Conversation

SimonCropp
Copy link
Contributor

The reason it does a hard coded subset is i want to avoid writing security info that may be in other headers (eg cookies).

static LogEventProperty GetRequestHeaders(HttpContext httpContext)
{
var values = httpContext.Request.Headers
.Where(x => allowedHeaders.Contains(x.Key.ToLowerInvariant()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use case insensitive comparoson instead ToLower ?

@nblumhardt
Copy link
Member

Hi @SimonCropp!

This would need to be an opt-in; currently the middleware adds only what's required in order to render its message template, since the bulk of request logs can quickly climb once more details are included.

#207 is related; we might want to align them somewhat. UseSerilogRequestLogging(opts => ...) gives us a hook point for something like opts.EnrichFromActivity= (an ActivityTrackingOptions flag set) and opts.EnrichFromRequest = (..something)...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants