EasyELK 1.0.1

dotnet add package EasyELK --version 1.0.1                
NuGet\Install-Package EasyELK -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EasyELK" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EasyELK --version 1.0.1                
#r "nuget: EasyELK, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EasyELK as a Cake Addin
#addin nuget:?package=EasyELK&version=1.0.1

// Install EasyELK as a Cake Tool
#tool nuget:?package=EasyELK&version=1.0.1                

EasyELK

An easy way to send log entries from your application directly to your existing ELK (Elasticsearch, Logstash, Kibana) stack. I´m assuming, that you already have configured your ELK properly. If you did not ... well it might happen, that EasyELK is not able to send log entries correctly.

Implement EasyELK

After loading the nuget package the implementation is quite simple. First you have to generate a logger object. It´s on your side, if you want to use it as a singleton or global or whatever.

EasyELK.Log2ELK elkLogger = new Log2ELK(elasticsearchurl, localLogFile,instanceName,minimalLogLevel,showConsole);

The params from first to last are meaning the following:

  1. {string} elasticsearchurl:

    The URL of your elasticsearch instance. Be sure to send it with http:// (or https://) and the correct port e.g. http://192.168.1.10:9200

  2. {string} localLogFile:

    The complete path where you want to store a fallback logfile where EasyELK is running. The logfile will only be written into, when something went wrong during sending your log to elasticsearch

  3. {string} instanceName:

    The name of your instance e.g. your machine name or something. This is necessary to find and filter specific log entries later in Kibana by the instance name.

  4. {enum LOGLEVEL} minimalLogLevel:

    The minimum log level which should EasyELK listen to. You find an order of the possible levels below

  5. {bool} showConsole:

    True if you want to also watch log messages in a separate console window, false if not

Log Levels

  • 0 = Verbose
  • 1 = Debug
  • 2 = Information
  • 3 = Warning
  • 4 = Error
  • 5 = Fatal

IMPORTANT: Be aware, that you using the minimal loglevel that you expect. Log messages below your minimum level will not be sent. For example if you set your minimal log level to Warning, and you send an Verbose message, the Verbose message will be ignored.

Sending a Log Message

Sending a log message whenever you want directly from your code just by using the following line of code

elkLogger.WriteLogEntry(logLevel, logMessage, template);
  1. {enum LOGLEVEL} logLevel:

    The level of your log entry that should be listed in Kibana

  2. {string} logMessage:

    The message you want to be transferred to Elasticsearch.

  3. {string} template:

    A template name which you can filter your entries later in Kibana. e.g. if you want to send a connection exception, simply name it "ConnectionException". You can then filter your exception messages by this template name as well as your index name, you defined when the object is instanced.

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.1 682 2/26/2019

Initial release