NLog Target for Azure ServiceBus Event Hub

NLog is a popular open source logging framework for .Net applications. It writes to various destinations via Target. It has a large number of Targets available available. I created a NLog Target that can send message to Azure ServiceBus EventHub. You can get the source code and documentation here: https://github.com/rajinders/nlog-targets-azureeventhub

I also created a NuGet package which you can download from here: https://www.nuget.org/packages/NLog.Targets.AzureEventHub/

If you already know how to use NLog it will take you a few minutes to start using the target.

Feel free to use it and let me know if you have any suggestions for improvements.

You may be wondering why would anyone would to send logs to Azure Event Hub. Most applications use logging frameworks to write application logs. These logs are not only helpful in debugging issues they are also a source for business intelligence. There are already successful companies like Splunk, Logentries and Loggly who provide cloud based log aggregation services. If you wanted to create your own log aggregation service without write a lot of code you can do so in Azure platform. You can send you log messages to EventHub with NLog or Serilog targets for EventHub. You can leverage Azure stream analytics service to process your log streams. You can even send these logs to Power BI to create dashboards. Both Azure Event Hub and stream analytics are highly scalable. Scaling up can be achieved by simple configuration changes.

This entry was posted in Azure, EventHub, NLog, ServiceBus and tagged , , , . Bookmark the permalink.
  • Diogo

    I’m building a monitoring platform and i need to send logs to a event hub from any web device, so it can’t be intrusive it should only use the webconfig or appconfig. I’ve been looking for logging services and so far i’ve found log4net, nlog and serilog, the last ones already have appenders for event hub, but i can’t seem to make any of those work by only using the config setting, which one should i use and how?. I’m currently using a sample asp.net mvc5 website to try and send logs to the event hub

    Thanks in advance,

    Diogo

    • rajisingh

      Diogo,
      When you say only changing the web.config do you meant that you don’t want to rebuild your existing applications. You hope to update web.config, add a reference to the sink, add the sink DLL to you bin directory and the logging to work. Don’t you also have to log messages in your application as well? Can you send me your source code for asp.net mvc5 so I can see what is going on. You can email me at rajindersingh at symbol Hotmail dot com.