Azure Log Analytics Logger extension for ASP.NET Core
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Azure Log Analytics ASP.NET Core Logging extension

This package extends the logging options for ASP.NET Core adding the possibility of sending logs directly to Azure Log Analytics as JSON payloads.

It uses the HTTPDataCollectorAPI package internally.

Get it

You can obtain this project as a Nuget Package.

Install-Package LogAnalytics.Extensions.Logging

Or reference it and use it according to the License.

Use it

Using it is simple, just reference the package and add it to the Logging pipeling in your Startup.cs file:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
			//Add Logger
			loggerFactory.AddLogAnalytics("{Your_Workspace_Id}", "{Your_Key_Id}", "{Your_Namespace}", LogLevel.Critical);

Your WorkspaceId and API Key are part of your Azure Log Analytics subscription.

The Namespace is the name that identifies your LogType in Azure Log Analytics, mostly used to identify your application or source.


Please feel free to report any issues you might encounter. Keep in mind that this library won't assure that your JSON payloads are being indexed, it will make sure that the HTTP Data Collection API responds an Accept but there is no way (right now) to know when has the payload been indexed completely.