fullscale180 / slab-sinks

Semantic Logging Application Block Sinks
Apache License 2.0
13 stars 9 forks source link

slab-sinks

This project contains Semantic Logging Application Block (SLAB) sinks to persist application events published to ETW and consumed by SLAB.

Sinks

Elasticsearch Sink

A sink to write Semantic Logging Application Block (SLAB) events to Elasticsearch.

0 Create an event source

Create a class derived from EventSource

You could also use EventSourceProxy

1 Install NuGet

Install-Package EnterpriseLibrary.SemanticLogging.Elasticsearch

2 Create a listener and enable events

var listener = new ObservableEventListener();

listener.EnableEvents(CommonEventSource.Log, EventLevel.LogAlways, ~EventKeywords.None);

3 Send events to Elasticsearch

listener.LogToElasticsearch(
    Environment.MachineName,
    "http://localhost:9200",
    "slab",
    "mylogs");