Skip to content

quintindk/NLog.AzureLog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

NLog.AzureLog

Custom NLog target for Azure Log Analytics

Example NLog.config

<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
      autoReload="true"
      throwExceptions="false"
      internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">

  <extensions>
    <add assembly="NLog.AzureLog" />
  </extensions>

  <targets>
    <target xsi:type="Azure" name="Azure" CustomerId="__WORKSPACE-ID__" SharedKey="__PRIMARY-KEY__"  LogName="__NAME__" >
      <layout xsi:type="JsonLayout">
        <attribute name="machine" layout="${machinename}" />
        <attribute name="time" layout="${longdate}" />
        <attribute name="level" layout="${level:upperCase=true}"/>
        <attribute name="message" layout="${message}" />
      </layout>
    </target>
  </targets>

  <rules>
    <!-- add your logging rules here -->

    <logger name="*" minlevel="Debug" writeTo="Azure" />

  </rules>
</nlog>

About

Custom NLog target for Azure Log Analytics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%