You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,30 @@ or in `appsettings.json` file:
37
37
38
38
The `WithClientIp()` enricher will add a `ClientIp` property and the `WithClientAgent()` enricher will add a `ClientAgent` property to produced events.
39
39
40
+
For `ClientIp` enricher you can configure the `X-forwarded-for` header if the proxy server uses a different header to forward IP address.
41
+
```csharp
42
+
Log.Logger=newLoggerConfiguration()
43
+
.Enrich.WithClientIp("CF-Connecting-IP")
44
+
...
45
+
```
46
+
```json
47
+
{
48
+
"Serilog": {
49
+
"MinimumLevel":"Debug",
50
+
"Using": [ "Serilog.Enrichers.ClientInfo" ],
51
+
"Enrich": [
52
+
"WithClientAgent",
53
+
{
54
+
"Name":"WithClientIp",
55
+
"Args": {
56
+
"xForwardHeaderName":"CF-Connecting-IP"
57
+
}
58
+
}
59
+
],
60
+
}
61
+
}
62
+
```
63
+
40
64
## Installing into an ASP.NET Core Web Application
0 commit comments