From 86734c71aafc0a663e82d61dfe045ced366a8c87 Mon Sep 17 00:00:00 2001 From: Martijn Laarman Date: Tue, 7 Jan 2020 12:00:34 +0100 Subject: [PATCH] Introduce readme for Elastic.Apm.NLog (#26) * Introduce readme for Elastic.Apm.NLog Also link the project in the main readme * Update src/Elastic.Apm.NLog/readme.md * Update src/Elastic.Apm.NLog/readme.md * Review nitpicks --- README.md | 17 ++++++++++- src/Elastic.Apm.NLog/readme.md | 34 ++++++++++++++++++++++ src/Elastic.Apm.SerilogEnricher/readme.md | 2 +- src/Elastic.CommonSchema.Serilog/README.md | 2 +- src/Elastic.CommonSchema/README.md | 2 +- 5 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/Elastic.Apm.NLog/readme.md diff --git a/README.md b/README.md index a67ea43f..b94d45f6 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,23 @@ var logger = new LoggerConfiguration() .CreateLogger(); ``` +When combined with `Elastic.CommonSchema.Serilog` the trace and transaction id will automatically appear in ECS format as well. + +```csharp +var logger = new LoggerConfiguration() + .Enrich.WithElasticApmCorrelationInfo() + // will have APM information persisted in ECS format + .WriteTo.Console(new EcsTextFormatter()) + .CreateLogger(); +``` + +### [Elastic.Apm.NLog](https://github.com/elastic/ecs-dotnet/tree/master/src/Elastic.Apm.NLog) + +Introduce two special place holder variables (`ElasticApmTraceId`, `ElasticApmTransactionId`) easily into your NLog templates. +[Learn more...](https://github.com/elastic/ecs-dotnet/tree/master/src/Elastic.Apm.NLog) + ## Copyright and License -This software is Copyright (c) 2014-2019 by Elasticsearch BV. +This software is Copyright (c) 2014-2020 by Elasticsearch BV. This is free software, licensed under: [The Apache License Version 2.0](https://github.com/elastic/ecs-dotnet/blob/master/license.txt). \ No newline at end of file diff --git a/src/Elastic.Apm.NLog/readme.md b/src/Elastic.Apm.NLog/readme.md new file mode 100644 index 00000000..615da6de --- /dev/null +++ b/src/Elastic.Apm.NLog/readme.md @@ -0,0 +1,34 @@ +# Elastic APM NLog Layout Renderer + +Allows you to add the following place holders in your NLog templates + +* `ElasticApmTraceId` +* `ElasticApmTransactionId` + +Which will be replaced with the appropriate Elastic APM variables if available + + +## How to Enable + +```csharp +var target = new MemoryTarget(); +target.Layout = "${ElasticApmTraceId}|${ElasticApmTransactionId}|${message}"; +Agent.Tracer.CaptureTransaction("TestTransaction", "Test", t => +{ + traceId = "trace-id"; + transactionId = "transaction-id"; + logger.Debug("InTransaction"); +}); +// Logged message will be in format of `trace-id|transation-id|InTransaction` +// or `||InTransaction` if the place holders are not available +``` + +## Prerequisite + +The prerequisite for this to work is a configured [Elastic APM Agent](https://github.com/elastic/apm-agent-dotnet). If the agent is not configured the APM place holders will be empty. + +## Copyright and License + +This software is Copyright (c) 2014-2020 by Elasticsearch BV. + +This is free software, licensed under: [The Apache License Version 2.0](https://github.com/elastic/ecs-dotnet/blob/master/license.txt). diff --git a/src/Elastic.Apm.SerilogEnricher/readme.md b/src/Elastic.Apm.SerilogEnricher/readme.md index 818d5bd9..b9dbd751 100644 --- a/src/Elastic.Apm.SerilogEnricher/readme.md +++ b/src/Elastic.Apm.SerilogEnricher/readme.md @@ -24,6 +24,6 @@ The prerequisite for this to work is a configured [Elastic APM Agent](https://gi ## Copyright and License -This software is Copyright (c) 2014-2019 by Elasticsearch BV. +This software is Copyright (c) 2014-2020 by Elasticsearch BV. This is free software, licensed under: [The Apache License Version 2.0](https://github.com/elastic/ecs-dotnet/blob/master/license.txt). diff --git a/src/Elastic.CommonSchema.Serilog/README.md b/src/Elastic.CommonSchema.Serilog/README.md index 5748f575..5f9ccc4d 100644 --- a/src/Elastic.CommonSchema.Serilog/README.md +++ b/src/Elastic.CommonSchema.Serilog/README.md @@ -41,6 +41,6 @@ An example of the output is given below: ## Copyright and License -This software is Copyright (c) 2014-2019 by Elasticsearch BV. +This software is Copyright (c) 2014-2020 by Elasticsearch BV. This is free software, licensed under: [The Apache License Version 2.0](https://github.com/elastic/ecs-dotnet/blob/master/license.txt). diff --git a/src/Elastic.CommonSchema/README.md b/src/Elastic.CommonSchema/README.md index b9cc4c73..e9af0781 100644 --- a/src/Elastic.CommonSchema/README.md +++ b/src/Elastic.CommonSchema/README.md @@ -197,6 +197,6 @@ This property is not part of the ECS specification, but is included as a means t ## Copyright and License -This software is Copyright (c) 2014-2019 by Elasticsearch BV. +This software is Copyright (c) 2014-2020 by Elasticsearch BV. This is free software, licensed under: [The Apache License Version 2.0](https://github.com/elastic/ecs-dotnet/blob/master/license.txt).