Kusto NLog connector now supports Azure Data Explorer Free Clusters

  • Thread starter Thread starter asaharn
  • Start date Start date
A

asaharn

large?v=v2&px=999.png

Introduction

NLog is a popular logging framework used by developers to log messages from .NET applications. NLog, a robust logging framework, captures and stores critical information, providing essential insights for debugging and optimization.



Earlier in the summer we released the open-source NLog connector for Azure Data Explorer. Azure Data Explorer (ADX) is a fast and highly scalable data exploration service that can be used to store and analyze large volumes of data.



In this blog post, we walk you through the latest enhancements in NLog connector for Azure Data Explorer which marks a significant leap forward in offering seamless integration with Azure Data Explorer for an unparalleled application behavior insights and monitoring.



In the latest connector update, a host of powerful features has been introduced. This includes seamless support for Free Azure Data Explorer Clusters and integration with KQL Database in Microsoft Fabric Real-Time Analytics. Now, developers can dive into the world of ADX without the need for an Azure account subscription or credit card. Simply create a free ADX account, and you're all set to harness the full potential of your logs using an ADX cluster.



Leveraging the expressive power of Kusto Query Language (KQL), developers can uncover invaluable insights into their application's behavior, performance metrics, error occurrences, and even detect anomalies. This newfound capability opens a world of possibilities for fine-tuning and optimizing applications based on data-driven decisions.



Moreover, bid farewell to the IngestionEndpoint property and embrace the power of Kusto Connection Strings. These strings serve as your all-access pass to a range of authentication modes, including the convenient User Prompt Authentication and the secure User Token Authentication.



Diving into the ADX Target Sample Application with latest updates

You can find the detailed initial setup steps in the previous blog post here: Getting started with NLog and Azure Data Explorer - Microsoft Community Hub



This will be like the previous blog but in context of Free Cluster and Connection string support.



Pre-requisites:


Steps

Create a table in Azure Data Explorer to store logs. The following command can be used to create a table with the name "ADXNLogSample".



.create table ADXNLogSample (Timestamp:datetime, Level:string, Message:string, FormattedMessage:dynamic, Exception:string, Properties:dynamic)



Clone the NLog-ADX target git repo.



git clone GitHub - Azure/azure-kusto-nlog-sink: Nlog custom target for storing logs to ADX



Set the following environment variables in the sample application:

  • CONNECTION_STRING : Kusto ConnectionString of ADX cluster created.
  • Eg: Data Source=https://ingest-<clustername>.<region>.kusto.windows.net;Fed=True
  • DATABASE: The name of the database to which data should be ingested into.

Simply build and run the application:

  • Install the ADX Target for NLog

The ADX Target for NLog is available as a NuGet package. To install it, open the Package Manager Console and enter the following command:



dotnet add package NLog.Azure.Kusto --version 2.0.1



Build the application and run it

  • Open a Powershell window, navigate to NLog ADX Target base folder and run the following command.
    dotnet build
  • Once build got completed, navigate to src/Nlog.Azure.Kusto.Samples/ run the following command to run the sample application.
    dotnet run
  • This is making the sample application, open a login prompt in your default browser, where you need to enter your username and password.

large?v=v2&px=999.jpg



  • The ingested log data can be verified by querying the created log table (ADXNLogSample in our case) by using the following KQL command.
    ADXNLogSample | take 10

large?v=v2&px=999.png

Conclusion

The NLog Azure Data Explorer Target connector is a great tool for log management that allows developers to send their log messages to ADX for analysis and visualization. With the new features of the connector such as support for ADX free cluster and Microsoft Fabric cluster, developers can now use ADX without an Azure account or credit card. By using KQL queries, developers can gain insights into their application behavior, performance, errors, and anomalies. We hope this article has helped you understand how to use the new features of the connector and how to make sense of your logs using an ADX cluster.



Documentation: Ingest data with the NLog sink into Azure Data Explorer - Azure Data Explorer | Microsoft Learn

Open-Source Repository: Azure/azure-kusto-nlog-sink: Nlog custom target for storing logs to ADX (github.com)

NLog Kusto Connector Nuget: NuGet Gallery | NLog.Azure.Kusto 2.0.1

Continue reading...
 
Back
Top