You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(Configuration)
.CreateLogger();
This works fine with the configuration that is coming from the appsettings.json. But I would like to override the source value for example. In my case, my application is running on service fabric, so it means that my code is going to be running on different nodes at a certain point in time and I would like to capture from which one in particular are these logs coming.
What I thought was going to work:
Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(Configuration)
.WriteTo
.DatadogLogs("mykeyvaluehere", source: Environment.MachineName)
.CreateLogger();
or
Log.Logger = new LoggerConfiguration()
.WriteTo
.DatadogLogs("mykeyvaluehere", source: Environment.MachineName)
.ReadFrom.Configuration(Configuration)
.CreateLogger();
I also try LoggerContext.PushProperty("dd.source", Environment.MachineName) and nothing
The text was updated successfully, but these errors were encountered:
I need to override dynamic values like host or service name coming from datadog appsettings.json
Here is my configuration:
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.Datadog.Logs" ],
"MinimumLevel": "Debug",
"WriteTo": [
{ "Name": "Console" },
{
"Name": "DatadogLogs",
"Args": {
"apiKey": "mykeyvaluehere",
"source": "mysource",
"host": "myhost",
"tags": [ "environment:dev"" ]
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "Sample"
}
}
C# code to read data with Serilog
This works fine with the configuration that is coming from the appsettings.json. But I would like to override the source value for example. In my case, my application is running on service fabric, so it means that my code is going to be running on different nodes at a certain point in time and I would like to capture from which one in particular are these logs coming.
What I thought was going to work:
I also try LoggerContext.PushProperty("dd.source", Environment.MachineName) and nothing
The text was updated successfully, but these errors were encountered: