Skip to content

Commit

Permalink
Introduce readme for Elastic.Apm.NLog (#26)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Mpdreamz authored Jan 7, 2020
1 parent 58e3045 commit 86734c7
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 4 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
34 changes: 34 additions & 0 deletions src/Elastic.Apm.NLog/readme.md
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 1 addition & 1 deletion src/Elastic.Apm.SerilogEnricher/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
2 changes: 1 addition & 1 deletion src/Elastic.CommonSchema.Serilog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
2 changes: 1 addition & 1 deletion src/Elastic.CommonSchema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

0 comments on commit 86734c7

Please sign in to comment.