Closed Jay-H-C closed 1 year ago
Hi @Jay-H-C
Can you please provide:
exceptionHandler
to catch errors)Thank you for the response here is what I have.
My config in the appsettings.json
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.Datadog.Logs" ],
"MinimumLevel": "Debug",
"WriteTo": [
{
"Name": "DatadogLogs",
"Args": {
"apiKey": "0acb20eec6f3d4-----------------",
"source": "Test",
"host": "DEV_MACHINE",
"tags": [ "TAG_1:VALUE_1", "TAG_2:VALUE_2" ]
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ],
"Properties": {
"Application": "Sample"
}
}
and my code:
using (var log = new LoggerConfiguration()
.WriteTo.DatadogLogs("0acb20eec6f3d4-----------------", configuration: new DatadogConfiguration() { Url = "https://http-intake.logs.us5.datadoghq.com" })
.CreateLogger())
{
log.Information("TEST LOG");
log.Error("TEST LOG ERROR");
}
What am I doing wrong? I am not getting any exceptions.
Thank you!
This is the exception I got by hooking up the exception handler:
Could not send payload to Datadog: [Forbidden] Forbidden - [{"ddsource":"csharp","message":"{\"timestamp\":\"2023-07-17T08:26:14.5418598-07:00\",\"message\":\"TEST LOG\",\"MessageTemplate\":\"TEST LOG\",\"level\":\"Information\",\"Properties\":{}}"},{"ddsource":"csharp","message":"{\"timestamp\":\"2023-07-17T08:26:14.5456529-07:00\",\"message\":\"TEST LOG ERROR\",\"MessageTemplate\":\"TEST LOG ERROR\",\"level\":\"Error\",\"Properties\":{}}"}].
Okay I switched to the default repo my removing the US5 address and I am seeing my logs.
Thank you!
I am trying to do Agentless logging trying to have a direct upload to Datadog without saving it as a file. but it does not work, Datadog is waiting for a log forever.