Created
August 4, 2019 14:02
-
-
Save oleh-zheleznyak/c9329623698302a15a1ea5b51e9738e6 to your computer and use it in GitHub Desktop.
Serilog ApplicationInsights config file to register an operation id enricher from custom assembly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Serilog": { | |
"Using": [ "YourCompany.YourComponent.YourProject", "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Enrichers.Environment", "Serilog.Sinks.Elasticsearch" ], | |
"MinimumLevel": { | |
"Default": "Information", | |
"Override": { | |
"Microsoft": "Warning", | |
"System": "Information" | |
} | |
}, | |
"WriteTo": [ | |
{ | |
"Name": "Async", | |
"Args": { | |
"configure": [ | |
{ "Name": "Console" }, | |
{ | |
"Name": "ApplicationInsights", | |
"Args": { | |
"restrictedToMinimumLevel": "Information", | |
"telemetryConverter": "YourCompany.YourComponent.YourProject.Serilog.OperationTelemetryConverter, YourCompany.YourComponent.YourProject" | |
} | |
} | |
] | |
} | |
} | |
], | |
"Enrich": [ "WithOperationId", "FromLogContext", "WithMachineName", "WithEnvironmentUserName", "WithThreadId" ], | |
"Properties": { | |
"Application": "YourCompany.YourComponent.YourProject" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment