Integrating with Application Insights


Matthew Boulton

December 1, 2021

10 Min


In this blog post we’re going to cover how you can use to get extra value from the telemetry you are already collecting with Application Insights.

First off, if you are using a logging framework, like Serilog, to collect logs and then forward them to Application Insights via a sink, then you can simply plug in as an additional sink for Serilog. This approach works for NLog and Log4Net as well and has been covered in a previous article so we won’t cover that here.

However, if Application Insights is your only source of telemetry, you can add Railtown as a Telemetry Processor. This means it is registered with the Application Insights TelemetryConfiguration and all telemetry that is sent to Application Insights goes through the processor as well. 

For more information about telemetry processors, please see this article: 

There are a number of ways of setting up Application Insights and choosing the right approach depends upon which version of .NET you are using. In this post, we’ll cover integrating with an ASP.NET Core web app. 

(If you’re using .NET framework and ApplicationInsights.config, the set up is very easy and you can read about that on our Support site: Using Application Insights to send logs (


Before we start, you’ll need a Railtown Key. You can get this from the Configuration section of the website. 

If you don’t already have a account, sign up now.

From the configure project page, go to the logs section and copy the contents of the RailtownKey node from the Application Insights xml configuration.

Install Nuget Packages

Next, you’ll need to add the ApplicationInsights.Railtown nuget package to your project: NuGet Gallery | ApplicationInsights.Railtown 1.3.0

Additionally, if you added Application Insights to your web application via the Azure Portal, you’ll need to add Microsoft’s ApplicationInsights.AspNetCore package as well: NuGet Gallery | Microsoft.ApplicationInsights.AspNetCore 2.19.0


If you were already using the ApplicationInsights ASP.NET Core package, you should see a line like this inside StartUp.cs:


The telemetry processor will be added in the same place, usually the ConfigureServices method:

public void ConfigureServices(IServiceCollection services)


     // ...


    services.AddSingleton(new RailtownTelemetryProcessorOptions() { 

        // put the Railtown Key here (or retrieve it from configuration like appsettings.json)        

        RailtownKey = "" 




The telemetry processor uses the options pattern so you will inject the Railtown Key via an options class. Add the RailtownKey value you obtained right at the beginning of this process. The snippet above shows how you’d put the key right in source code, but it’s good practice to retrieve this from configuration instead. You should treat your Railtown Key as a password and never check it into source code. You can read more about the Options pattern here: Options pattern in ASP.NET Core | Microsoft Docs

Now your application is configured to send Application Insights logs to Railtown will automatically receive any events captured by Application Insights from these sources:




throw Exception // when not caught

To configure other types of .NET projects or to troubleshoot, please visit our support page here: Using Application Insights to send logs (

I hope this has demonstrated how easy it is to use your existing Application Insights instrumentation to send logs to

If you don’t already have a account sign up and let us help you improve the quality of your software and increase your developer velocity.

Keep reading

AppInsightsBest Tools to Integrate with helps you gather the information you need to efficiently resolve an error, but by combining our application with other tools can take your developer workflow to the next level. So today, we’d like to go through 2 popular tools that we recommend for expanding your team’s capabilities: New Relic and Azure Application Insights.


Marwan Haddad

January 6, 2023

5 Min.


CultureHow to Build a Positive Culture Within Development Team on Debugging

Too many software development teams treat error logging as a burden rather than a chance to grow.That’s why Jeli’s “Howie: Post-Incident Guide” felt like a breath of fresh air. In the guide, Jeli’s team notes that negative treatment of bugs is everywhere, including the language we use to describe software development. Terms like “post-mortem” and “root-cause analysis” speak for themselves.We’d like to build on the suggestions put forward in Howie and share our perspective on error logging as well. So let’s take a look at how a small mindset shift around debugging could encourage more positive moments in your team.


Marwan Haddad

December 1, 2022

5 Min


Error BucketNode.js Monitoring: Performance Monitoring Best Practices

Plenty of developers who start coding in Node.js do so because of how easy it is to get started. But once you are ready to take your application to the next level, you need to take a step back. Why did you choose to build in Node.js, and where do you want to take your application from here? To scale your Node.js application, you need to figure out just how to use performance monitoring to your advantage.


Marwan Haddad

November 21, 2022

5 Min