Serilog.Enrichers.ClientInfo 1.2.0

.NET Standard 2.0 .NET Framework 4.6.2
dotnet add package Serilog.Enrichers.ClientInfo --version 1.2.0
NuGet\Install-Package Serilog.Enrichers.ClientInfo -Version 1.2.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Serilog.Enrichers.ClientInfo" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Serilog.Enrichers.ClientInfo --version 1.2.0
#r "nuget: Serilog.Enrichers.ClientInfo, 1.2.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Serilog.Enrichers.ClientInfo as a Cake Addin
#addin nuget:?package=Serilog.Enrichers.ClientInfo&version=1.2.0

// Install Serilog.Enrichers.ClientInfo as a Cake Tool
#tool nuget:?package=Serilog.Enrichers.ClientInfo&version=1.2.0

serilog-enrichers-clientinfo NuGet

Enrich logs with client IP and UserAgent.

Install the Serilog.Enrichers.ClientInfo NuGet package

Install-Package Serilog.Enrichers.ClientInfo


dotnet add package Serilog.Enrichers.ClientInfo

Apply the enricher to your LoggerConfiguration in code:

Log.Logger = new LoggerConfiguration()
    // ...other configuration...

or in appsettings.json file:

  "Serilog": {
    "MinimumLevel": "Debug",
    "Using":  [ "Serilog.Enrichers.ClientInfo" ],
    "Enrich": [ "WithClientIp", "WithClientAgent"],
    "WriteTo": [
      { "Name": "Console" }

The WithClientIp() enricher will add a ClientIp property and the WithClientAgent() enricher will add a ClientAgent property to produced events.

For ClientIp enricher you can configure the X-forwarded-for header if the proxy server uses a different header to forward IP address.

Log.Logger = new LoggerConfiguration()
  "Serilog": {
    "MinimumLevel": "Debug",
    "Using":  [ "Serilog.Enrichers.ClientInfo" ],
    "Enrich": [ 
        "Name": "WithClientIp",
        "Args": {
          "xForwardHeaderName": "CF-Connecting-IP"

Installing into an ASP.NET Core Web Application

You need to register the IHttpContextAccessor singleton so the enrichers have access to the requests HttpContext to extract client IP and client agent. This is what your Startup class should contain in order for this enricher to work as expected:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;

namespace MyWebApp
    public class Startup
        public Startup()
            Log.Logger = new LoggerConfiguration()
                .WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3} {ClientIp} {ClientAgent}] {Message:lj}{NewLine}{Exception}")

        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit
        public void ConfigureServices(IServiceCollection services)
            // ...
            // ...

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
            // ...
            // ...
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (21)

Showing the top 5 NuGet packages that depend on Serilog.Enrichers.ClientInfo:

Package Downloads

KAM.Aether.SharedLibraries and SharedModels


This package for SuchenExpert projects




CodeZero is a set of common implementations to help you implementing Clean Architecture, DDD, CQRS, Specification Patterns and another facilities for new modern web applications is an open-source project written in .NET Core.

Farsica.Framework Core Application Framework

GitHub repositories (2)

Showing the top 2 popular GitHub repositories that depend on Serilog.Enrichers.ClientInfo:

Repository Stars
This is a repository for creating a Blazor Server dashboard application following the principles of Clean Architecture
helps in managing visitors visiting the institutions for various reasons. It allows visitors to check-in digitally to eliminate the tedious registeration and other paperwork. Additionally, it also keeps a track of every individual inside the campus and their timings. Institutions has guards who enter their detail in some notebooks to keep a log which are practically impossible to reconcile. It is really unpleasent and hectic for visitor to stand at the gate and give details about the visit. To ease the process of registeration, Entry-In, Entry-Out, time tracking and logging the history, this VMS can be of great use!!
Version Downloads Last updated
1.2.0 549,262 6/26/2022
1.1.4 1,193,792 8/22/2021
1.1.4-dev01 174 8/22/2021
1.1.3 865,838 12/18/2020
1.1.2 111,570 12/7/2020
1.1.1 330 12/6/2020
1.1.0 101,483 4/23/2020
1.0.0 11,020 1/5/2020

- Configure `X-forward-header` for client IP enricher
- Drop support.NET 4.5.2