I have a Web API and I'm trying to log messages into Graylog, using Serilog. Now matter what I do, no messages are shown in my Graylog application. This is what I have so far:
This is in my Program.cs
var logger = new LoggerConfiguration().
ReadFrom.Configuration(builder.Configuration).
Enrich.FromLogContext().
CreateLogger();
builder.Logging.ClearProviders();
builder.Logging.AddSerilog(logger);
This is my configuration:
"Serilog": {
"Using": [ "Serilog.Sinks.Graylog" ],
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Graylog",
"Args": {
"hostnameOrAddress": "127.0.0.1",
"port": "12201",
"transportType": "Udp"
}
}
],
"Properties": {
"Application": "Centralized logging application"
}
},
"AllowedHosts": "*"
}
And I'm trying to log a:
_logger.LogError(0, new Exception("Exception Message"), "Message", new WeatherForecast());
Can someone please help me? I need to see my exception inside Graylog.
Thanx a lot in advance