Skip to content

Request logging path based filtering #100

Closed
@jakejscott

Description

@jakejscott

Hi @nblumhardt just wanted to suggest a feature for the request logging middleware...

We've been using an earlier version of this middleware that I think you blogged about at some point. Anyway, one thing that we did is made it possible to filter out certain paths for example the health check endpoints. We send our logs to Sumologic and the bills can get expensive so we reduced logging by getting rid of these logs. We just change the log level to Debug.

For example:

var path = GetPath(httpContext);
switch (path)
{
    case "/":
    case "/ping":
    case "/live":
    case "/ready":
        level = LogEventLevel.Debug;
        break;
}

Would you be interested in this idea? An optional callback function in the RequestLoggingOptions which could decide the log level or to not log at all. The other way it could be done is by extending RequestLoggingMiddleware with a subclass perhaps.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions