| IAppBuilderExtensionsUseAzureHttpLogger Method |
In order to capture the full set of data during a HTTP request this OWIN plugin must be the first plugin in the chain.
Configure OWIN to trace HTTP requests and responses. Note that capturing request query parameters and request and response data could cause
data security issues - potentially sensitive data will be logged to Azure table storage.
Therefore by default none of this is captured.
The HTTP traces are stored in these tables:
httprequestbydatedescending
httprequestbycorrelationid
If this causes you any conflicts then the table names can be given an optional prefix using the azurePrefix parameter.
Request and response data is stored in blob containers named httprequestdata and httpresponsedata respectively and the azurePrefix
parameter is also applied to these container names. Blob names are linked to the log item ID held within the tables.
Namespace: AccidentalFish.ApplicationSupport.Owin.AzureAssembly: AccidentalFish.ApplicationSupport.Owin.Azure (in AccidentalFish.ApplicationSupport.Owin.Azure.dll) Version: 0.9.0.0 (0.9.0.0)
Syntaxpublic static IAppBuilder UseAzureHttpLogger(
this IAppBuilder appBuilder,
string storageConnectionString,
bool captureRequestParams = false,
bool captureRequestData = false,
bool captureResponseData = false,
string[] captureRequestHeaders = null,
string[] captureResponseHeaders = null,
string httpCorrelationHeaderKey = "correlation-id",
string azurePrefix = "",
LogByDateGranularityEnum granularity = LogByDateGranularityEnum.Hour
)
<ExtensionAttribute>
Public Shared Function UseAzureHttpLogger (
appBuilder As IAppBuilder,
storageConnectionString As String,
Optional captureRequestParams As Boolean = false,
Optional captureRequestData As Boolean = false,
Optional captureResponseData As Boolean = false,
Optional captureRequestHeaders As String() = Nothing,
Optional captureResponseHeaders As String() = Nothing,
Optional httpCorrelationHeaderKey As String = "correlation-id",
Optional azurePrefix As String = "",
Optional granularity As LogByDateGranularityEnum = LogByDateGranularityEnum.Hour
) As IAppBuilder
Parameters
- appBuilder
- Type: IAppBuilder
The app builder extended - storageConnectionString
- Type: SystemString
The storage string for - captureRequestParams (Optional)
- Type: SystemBoolean
True if you wish to capture query parameters, false if not. - captureRequestData (Optional)
- Type: SystemBoolean
True if you wish to capture request data, false if not. - captureResponseData (Optional)
- Type: SystemBoolean
True if you wish to capture response data, falise if not. - captureRequestHeaders (Optional)
- Type: SystemString
To capture all request headers set a single array element of "*" otherwise specify the headers you wish to capture. - captureResponseHeaders (Optional)
- Type: SystemString
To capture all response headers set a single array element of "*" otherwise specify the headers you wish to capture. - httpCorrelationHeaderKey (Optional)
- Type: SystemString
It can be helpful when calling across http boundaries to be able to tie together the flow of events with a correlation ID and by default the logger
looks for a correlation ID in the header correlation-id. If the header is missing then no correlation ID is used but the logger will work. If you
wish to disable this behaviour then set this to null or if you want to use a different header then set the header name here.
The HttpCorrelator middleware also in this assembly can be used to add a correlation ID if none is present and should be placed before the logger middleware
in the pipeline.
- azurePrefix (Optional)
- Type: SystemString
If you need to avoid table name conflicts - granularity (Optional)
- Type: AccidentalFish.ApplicationSupport.Owin.AzureLogByDateGranularityEnum
Sets the level of granularity on the partition key of the httprequestbydatedescending table. Busier your site likely the more granular you want
this to be. Defaults to hourly
Return Value
Type:
IAppBuilder[Missing <returns> documentation for "M:AccidentalFish.ApplicationSupport.Owin.Azure.IAppBuilderExtensions.UseAzureHttpLogger(Owin.IAppBuilder,System.String,System.Boolean,System.Boolean,System.Boolean,System.String[],System.String[],System.String,System.String,AccidentalFish.ApplicationSupport.Owin.Azure.LogByDateGranularityEnum)"]
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IAppBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also