I have .NET 5 web app which is supposed to write logs to DataDog using Serilog Sink (Serilog.Sinks.Datadog.Logs v0.5.2). Here is my Program.cs:
static async Task Main(string[] args)
{
using (var log = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.DatadogLogs("HERE IS MY API KEY", service: "myservice", configuration: new DatadogConfiguration() { Url = "https://http-intake.logs.us3.datadoghq.com" })
.CreateLogger())
{
log.Debug("debug");
log.Information("information");
log.Verbose("verbose");
log.Warning("warning");
log.Error("error");
log.Fatal("fatal");
}
using IHost host = CreateHostBuilder(args).Build();
await host.RunAsync();
}
After running the app i can see all these logs in DataDog EXCEPT Information logs. So, i see only 5 messages instead of 6. What i’m doing wrong?
2
Answers
The reason turned out to be on DataDog side. There was an indexation rule set up in our Logs Configuration that is telling to exclude 99% of all INFO logs (DataDog > Logs > Configuration > Indexes tab). Disabling this rule solved the issue.
I think the issue is that you’re setting the Serilog log event level but not the Datadog level. Try this: