# Umbraco logging to Azure Application Insights

Published: 25 June 2021
Category: Technology

Yet another post to remind me how to do this in future as I couldn't find any clear documentation.

It turns out that it's actually quite simple to configure Umbraco to log to App Insights.

This assumes that you have already created the App Insights instance in Azure and noted the Instrumentation Key.

First, you need to configure your project to have the necessary dependencies.  This is the same process for any ASP.NET MVC (for .NET Framework) based web application.

Follow [the instructions here](https://docs.microsoft.com/en-gb/azure/azure-monitor/app/asp-net#add-application-insights-automatically).  Apply these changes to your web application, where Umbraco is installed.

This will start logging exceptions and requests to App Insights, but not Umbraco logs.

Umbraco uses Serilog for logging, so we just need to install the Serilog "sink" to send logs to App Insights.

Install the `Serilog.Sinks.ApplicationInsights` NuGet package (latest version is fine).

With the sink package installed, add the following to the `<appSettings />` section of the `config/serilog.user.config` file in your Umbraco project.

~~~xml
<add key="serilog:using:ApplicationInsights" value="Serilog.Sinks.ApplicationInsights"/>
<add key="serilog:write-to:ApplicationInsights.telemetryConverter" value="Serilog.Sinks.ApplicationInsights.Sinks.ApplicationInsights.TelemetryConverters.TraceTelemetryConverter, Serilog.Sinks.ApplicationInsights"/>
<add key="serilog:minimum-level:override:Microsoft" value="Warning" />
~~~

It can take some time (up to ~15 minutes) for logs to come through to App Insights.

In the Logs section of your App Insights instance, you can query `requests` to see the HTTP requests, `exceptions` for any exceptions that have been thrown and `traces` for any Umbraco logs.
