NLog.Azure.Kusto
1.1.0
See the version list below for details.
dotnet add package NLog.Azure.Kusto --version 1.1.0
NuGet\Install-Package NLog.Azure.Kusto -Version 1.1.0
<PackageReference Include="NLog.Azure.Kusto" Version="1.1.0" />
paket add NLog.Azure.Kusto --version 1.1.0
#r "nuget: NLog.Azure.Kusto, 1.1.0"
// Install NLog.Azure.Kusto as a Cake Addin #addin nuget:?package=NLog.Azure.Kusto&version=1.1.0 // Install NLog.Azure.Kusto as a Cake Tool #tool nuget:?package=NLog.Azure.Kusto&version=1.1.0
NLog.Azure.Kusto
An Azure Data Explorer(ADX) custom target that writes log events to an Azure Data Explorer (Kusto) cluster.
Package - NLog.Azure.Kusto | Platforms - .Net 6.0
Getting started
Install from NuGet:
Install-Package NLog.Azure.Kusto
Configuration
Add the ADX target to your NLog configuration:
<nlog>
<extensions>
<add assembly="NLog.Azure.Kusto"/>
</extensions>
<targets>
<target name="adxtarget" xsi:type="ADXTarget"
IngestionEndpointUri="<ADX connection string>"
Database="<ADX database name>"
TableName="<ADX table name>"
ApplicationClientId="<AAD App clientId>"
ApplicationKey="<AAD App key>"
Authority="<AAD tenant id>"
/>
</targets>
<rules>
<logger minlevel="Info" name="*" writeTo="adxtarget"/>
</rules>
</nlog>
Available Configuration Options
Option | Description |
---|---|
IngestionEndpointUri | Ingest URL of ADX cluster created. Eg: https://ingest-<clustername>.<region>.kusto.windows.net . |
Database | The name of the database to which data should be ingested into. |
TableName | The name of the table to which data should be ingested. |
AuthenticationMode | Authentication mode to be used by ADX target. |
ApplicationClientId | Application Client ID required for authentication. |
ApplicationKey | Application key required for authentication. |
Authority | Tenant Id of the Azure Active Directory. |
ManagedIdentityClientId | In case of ManagedIdentity Authentication, this need to be set for user assigned identity. |
FlushImmediately | In case queued ingestion is selected, this property determines if is needed to flush the data immediately to ADX cluster. Not recommended to enable for data with higher workloads. The default is false. |
MappingNameRef | Use a data mapping configured in ADX. |
ColumnsMapping | Use an ingestion-time data mapping. |
IngestionTimout | Set timeout for ingestions in seconds. |
Mapping
Azure Data Explorer provides data mapping capabilities, allowing the ability to extract data rom the ingested JSONs as part of the ingestion. This allows paying a one-time cost of processing the JSON during ingestion, and reduced cost at query time.
By default, the sink uses the following data mapping:
Column Name | Column Type | JSON Path |
---|---|---|
Timestamp | datetime | $.Timestamp |
Level | string | $.Level |
Message | string | $.Message |
FormattedMessage | dynamic | $.FormattedMessage |
Exception | string | $.Exception |
Properties | dynamic | $.Properties |
This mapping can be overridden using the following options:
- MappingNameRef: Use a data mapping configured in ADX.
- ColumnsMapping: Use an ingestion-time data mapping.
Authentication
Authentication can be used by setting the AuthenticationMode
property in the nlog target configuration.
AuthenticationMode="<authentication_method_name>"
The authentication_method_name
can be replaced with the following supported authentication methods:
AadApplicationKey
- This is the default authentication mode. This requires the following properties to be set in the nlog target configuration.
ApplicationClientId
ApplicationKey
Authority
- This is the default authentication mode. This requires the following properties to be set in the nlog target configuration.
AadUserManagedIdentity
- This authentication mode can be of two types System Assigned Managed Identity and User Assigned Managed Identity. In case of User Assigned Managed Identity, it requires the following properties to be set in the nlog target configuration:
ManagedIdentityClientId
- This authentication mode can be of two types System Assigned Managed Identity and User Assigned Managed Identity. In case of User Assigned Managed Identity, it requires the following properties to be set in the nlog target configuration:
Running tests
To run the tests locally, you need to have an ADX cluster created.
Export environment variables for the following:
For Windows:
$env:INGEST_ENDPOINT="<ingestionURI>" $env:APP_ID="<appId>" $env:APP_KEY="<appKey>" $env:AZURE_TENANT_ID="<tenant>" $env:DATABASE="<databaseName>"
For Mac/Linux:
export INGEST_ENDPOINT="<ingestionURI>" export APP_ID="<appId>" export APP_KEY="<appKey>" export AZURE_TENANT_ID="<tenant>" export DATABASE="<databaseName>"
Run the tests using the following command:
dotnet test
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.Azure.Kusto.Data (>= 11.3.1)
- Microsoft.Azure.Kusto.Ingest (>= 11.3.1)
- Microsoft.IO.RecyclableMemoryStream (>= 2.3.2)
- NLog (>= 5.1.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.