From 0b46dfdb550c9c17185a4794639c9c31256e4d0c Mon Sep 17 00:00:00 2001 From: Vadim Hatsura Date: Mon, 28 Jan 2019 00:31:31 +0300 Subject: [PATCH 1/2] Add small info regarding formatters into readme --- README.md | 30 +++++++++++++++++-- .../Serilog.Sinks.Elasticsearch.Sample.csproj | 2 +- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8cf074c7..5bce69c6 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,18 @@ -# Serilog.Sinks.Elasticsearch +# Serilog.Sinks.Elasticsearch [![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master) -[![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master) +This repository contains two nuget packages: + +`Serilog.Sinks.Elasticsearch` [![NuGet Badge](https://buildstats.info/nuget/Serilog.Sinks.Elasticsearch)](https://www.nuget.org/packages/Serilog.Sinks.Elasticsearch) + +`Serilog.Formatting.Elasticsearch` [![NuGet Badge](https://buildstats.info/nuget/Serilog.Formatting.Elasticsearch)](https://www.nuget.org/packages/Serilog.Formatting.Elasticsearch) ## Table of contents * [What is this sink](#what-is-this-sink) * [Features](#features) * [Quick start](#quick-start) + * [Elasticsearch sinks](#elasticsearch-sinks) + * [Elasticsearch formatters](#elasticsearch-formatters) * [More information](#more-information) * [A note about fields inside Elasticsearch](#a-note-about-fields-inside-elasticsearch) * [A note about Kibana](#a-note-about-kibana) @@ -30,6 +36,8 @@ The Serilog Elasticsearch sink project is a sink (basically a writer) for the Se ## Quick start +### Elasticsearch sinks + ```powershell Install-Package serilog.sinks.elasticsearch ``` @@ -88,6 +96,24 @@ With the appSettings configuration the `nodeUris` property is required. Multiple And start writing your events using Serilog. +### Elasticsearch formatters + +```powershell +Install-Package serilog.formatting.elasticsearch +``` + +The `Serilog.Formatting.Elasticsearch` nuget package consists of a several formatters: + +* `ElasticsearchJsonFormatter` - custom json formatter that respects the configured property name handling and forces `Timestamp` to @timestamp. +* `ExceptionAsObjectJsonFormatter` - a json formatter which serializes any exception into an exception object. + +Override default formatter if it's possible with selected sink + +```csharp +var loggerConfig = new LoggerConfiguration() + .WriteTo.Console(new ElasticsearchJsonFormatter()); +``` + ## More information * [Basic information](https://github.com/serilog/serilog-sinks-elasticsearch/wiki/basic-setup) on how to configure and use this sink. diff --git a/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj b/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj index 970e4d9b..a0d31cb1 100644 --- a/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj +++ b/sample/Serilog.Sinks.Elasticsearch.Sample/Serilog.Sinks.Elasticsearch.Sample.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.1 + netcoreapp2.0 From 091a789f7893a226a6f082c86c79ce47ff6369c3 Mon Sep 17 00:00:00 2001 From: Vadim Hatsura Date: Mon, 28 Jan 2019 00:34:08 +0300 Subject: [PATCH 2/2] add nuget badge to readme --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 5bce69c6..3279596b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ -# Serilog.Sinks.Elasticsearch [![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master) +# Serilog.Sinks.Elasticsearch [![Build status](https://ci.appveyor.com/api/projects/status/bk367tcnx9qt2sjy/branch/master?svg=true)](https://ci.appveyor.com/project/serilog/serilog-sinks-elasticsearch/branch/master) [![NuGet Badge](https://img.shields.io/nuget/v/Serilog.Sinks.Elasticsearch.svg)](https://www.nuget.org/packages/Serilog.Sinks.Elasticsearch) -This repository contains two nuget packages: - -`Serilog.Sinks.Elasticsearch` [![NuGet Badge](https://buildstats.info/nuget/Serilog.Sinks.Elasticsearch)](https://www.nuget.org/packages/Serilog.Sinks.Elasticsearch) - -`Serilog.Formatting.Elasticsearch` [![NuGet Badge](https://buildstats.info/nuget/Serilog.Formatting.Elasticsearch)](https://www.nuget.org/packages/Serilog.Formatting.Elasticsearch) +This repository contains two nuget packages: `Serilog.Sinks.Elasticsearch` and `Serilog.Formatting.Elasticsearch`. ## Table of contents