log4stash 2.2.1

log4stash - Elasticsearch log4net appender

log4stash is a log4net appender for easy logging of exceptions and messages to Elasticsearch indices.
     You can configure few filters to analyze log events before they got sended to Elasticsearch similar to the filters on logstash.

Install-Package log4stash -Version 2.2.1
dotnet add package log4stash --version 2.2.1
paket add log4stash --version 2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

log4stash

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.

Features:

  • Supports .NET 4.0+ and .NET Core
  • 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.

Filters:

  • 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.

<!-- ### Usage:
Please see the DOCUMENTATION Wiki page to begin logging errors to ElasticSearch! -->

Issues:

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">
    <Server>localhost</Server>
    <Port>9200</Port>
    <ElasticFilters>
      <!-- example of using filter with default parameters -->
      <kv /> 
    </ElasticFilters>
</appender>

License:

MIT License

Thanks:

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.

log4stash

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.

Features:

  • Supports .NET 4.0+ and .NET Core
  • 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.

Filters:

  • 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.

<!-- ### Usage:
Please see the DOCUMENTATION Wiki page to begin logging errors to ElasticSearch! -->

Issues:

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">
    <Server>localhost</Server>
    <Port>9200</Port>
    <ElasticFilters>
      <!-- example of using filter with default parameters -->
      <kv /> 
    </ElasticFilters>
</appender>

License:

MIT License

Thanks:

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.

Release Notes

* 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.

Version History

Version Downloads Last updated
2.2.1 (current) 271 6/19/2018
2.2.0 48 6/19/2018
2.1.0 5,181 11/8/2017
2.0.5 1,803 10/18/2017
2.0.4 7,295 3/20/2017
2.0.2-c 374 8/23/2016
2.0.1 7,345 7/10/2016
2.0.0 962 5/30/2016
1.1.1 43,601 1/22/2016
1.1.0 2,180 10/10/2015
1.0.2 2,013 4/27/2015
1.0.1 1,206 12/30/2014
1.0.0 459 10/9/2014
0.1.0 511 9/20/2014