AspNetRequestIpLayoutRenderer Class |
Namespace: NLog.Web.LayoutRenderers
The AspNetRequestIpLayoutRenderer type exposes the following members.
Name | Description | |
---|---|---|
AspNetRequestIpLayoutRenderer | Initializes a new instance of the AspNetRequestIpLayoutRenderer class |
Name | Description | |
---|---|---|
CheckForwardedForHeader |
Gets or sets whether the renderer should check value of ForwardedForHeader header
| |
CheckForwardedForHeaderOffset |
Gets or sets the array index of the X-Forwarded-For header to use, if the desired client IP is not at
the zeroth index. Defaults to zero. If the index is too large the last array element is returned instead.
If a negative index is used, this is used as the position from the end of the array.
Minus one will indicate the last element in the array. If the negative index is too large the first index
of the array is returned instead.
| |
ForwardedForHeader |
The header name to check for the Forwarded-For. Default "X-Forwarded-For". Needs CheckForwardedForHeader | |
HttpContextAccessor |
Provides access to the current request HttpContext.
(Inherited from AspNetLayoutRendererBase.) | |
LoggingConfiguration |
Gets the logging configuration this target is part of.
(Inherited from LayoutRenderer.) | |
ValueFormatter |
Value formatter
(Inherited from LayoutRenderer.) |
Name | Description | |
---|---|---|
Append |
Validates that the HttpContext is available and delegates append to subclasses.StringBuilder.
(Inherited from AspNetLayoutRendererBase.) | |
CloseLayoutRenderer |
Closes the layout renderer.
(Inherited from AspNetLayoutRendererBase.) | |
DoAppend |
Renders the value of layout renderer in the context of the specified log event into StringBuilder.
(Overrides AspNetLayoutRendererBaseDoAppend(StringBuilder, LogEventInfo).) | |
GetCulture |
Get the CultureInfo for rendering the messages to a String (Inherited from LayoutRenderer.) | |
GetFormatProvider |
Get the IFormatProvider for rendering the messages to a String (Inherited from LayoutRenderer.) | |
InitializeLayoutRenderer |
Initializes the layout renderer.
(Inherited from LayoutRenderer.) | |
Render |
Renders the value of layout renderer in the context of the specified log event.
(Inherited from LayoutRenderer.) | |
ResolveServiceT |
Resolves the interface service-type from the service-repository
(Inherited from LayoutRenderer.) | |
ToString | Returns a string that represents the current object. (Inherited from LayoutRenderer.) |
1${aspnet-request-ip} - Return the Remote IP 2${aspnet-request-ip:CheckForwardedForHeader=true} - Return first element in the X-Forwarded-For header 3${aspnet-request-ip:CheckForwardedForHeaderOffset=1} - Return second element in the X-Forwarded-For header 4${aspnet-request-ip:CheckForwardedForHeaderOffset=-1} - Return last element in the X-Forwarded-For header 5${aspnet-request-ip:CheckForwardedForHeader=true:ForwardedForHeader=myHeader} - Return first element in the myHeader header