log4stash 2.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package log4stash --version 2.2.0                
NuGet\Install-Package log4stash -Version 2.2.0                
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="log4stash" Version="2.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add log4stash --version 2.2.0                
#r "nuget: log4stash, 2.2.0"                
#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 log4stash as a Cake Addin
#addin nuget:?package=log4stash&version=2.2.0

// Install log4stash as a Cake Tool
#tool nuget:?package=log4stash&version=2.2.0                


log4stash is a log4net appender to log messages to the ElasticSearch document database. ElasticSearch offers robust full-text search engine and analyzation so that errors and messages can be indexed quickly and searched easily.

log4stash provide few logging filters similar to the filters on logstash.

The origin of log4stash is @jptoto's log4net.ElasticSearch repository.


  • Supports .NET 3.5+
  • Easy installation and setup via Nuget
  • Ability to analyze the log event before sending it to elasticsearch using built-in filters and custom filters similar to logstash.

Breaking Changes:

Navigate to breaking changes page here. See also Version notes page.


  • Add - add new key and value to the event.
  • Remove - remove key from the event.
  • Rename - rename key to another name.
  • Kv - analyze value (default is to analyze the 'Message' value) and export key-value pairs using regex (similar to logstash's kv filter).
  • Grok - analyze value (default is 'Message') using custom regex and saved patterns (similar to logstash's grok filter).
  • ConvertToArray - split raw string to an array by given seperators.
  • Json - convert json string to an object (so it will be parsed as object in elasticsearch).
  • Convert - Available convertors: ToString, ToLower, ToUpper, ToInt and ToArray. See config example for more information.
  • Xml - Parse xml into an object.
Custom filter:

To add your own filters you just need to implement the interface IElasticAppenderFilter on your assembly and configure it on the log4net configuration file.


I do my best to reply to issues or questions ASAP. Please use the ISSUES page to submit questions or errors.

Configuration Examples:

Almost all the parameters are optional, to see the default values check the c'tor of the appender and the c'tor of every filter. You can also set any public property in the appender/filter which didn't appear in the example.

Simple configuration:
<appender name="ElasticSearchAppender" type="log4stash.ElasticSearchAppender, log4stash">
      <kv /> 


MIT License


Thanks to @jptoto for the idea and the first working ElasticAppender. Many thanks to @mpdreamz and the team for their great work on the NEST library! The inspiration to the filters and style had taken from elasticsearch/logstash project.

Product Compatible and additional computed target framework versions.
.NET Framework net40 is compatible.  net403 was computed.  net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on log4stash:

Package Downloads


GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.4 67,944 7/11/2021
3.0.3 947 7/11/2021
3.0.2 5,659 6/28/2021
3.0.0 166,497 4/12/2020
2.3.0 7,754 4/9/2020
2.2.2-pre 1,381 1/7/2019
2.2.1 215,402 6/19/2018
2.2.0 3,728 6/19/2018
2.1.0 43,270 11/8/2017
2.0.5 21,960 10/18/2017
2.0.4 95,486 3/20/2017
2.0.2-c 1,965 8/23/2016
2.0.1 35,302 7/10/2016
2.0.0 3,028 5/30/2016
1.1.1 50,409 1/22/2016
1.1.0 5,677 10/10/2015
1.0.2 6,853 4/27/2015
1.0.1 27,077 12/30/2014
1.0.0 3,102 10/9/2014
0.1.0 2,152 9/20/2014

* Supporting .net core 2.
     * Using RestSharp for the ElasticClient instead of legacy code.
     * Update content-type in aws signing code.
    * Closed issues:
       ** #26 Make compatible with .NET Core
       ** #40 Error 406 with ElasticSearch 6.0 RC 2
       ** #47 Remove `(Begin/End)GetRequest` async mechanism
     * Merged pull requests
       ** #42 Updated the nuspec to support .net core 2.0
       ** #48 Replaced WebRequest with RestSharp
       ** #49 update content-type in aws signing code to application/json for ES 6.0
     Thanks a lot to @erangil2 for his tremendous contributions :)
     And thanks to: @zhengziying, @triarc, @prime8, @henkish, @mfpalladino, @ignasv, @wpgh, @Thecentury and @pnumainville for their contributions.