Azure Log Analytics Logger extension for ASP.NET Core
C#
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/LogAnalytics.Extensions.Logging
test/LogAnalytics.Extensions.Logging.Test
.gitattributes
.gitignore
LICENSE
README.md
loganalytics-extensions-logging.sln

README.md

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);
			app.UseMvcWithDefaultRoute();			
}

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.

Issues

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.