我正在尝试使用 graylog sink 将日志记录添加到 .net core web api。所需的输出与使用以下格式的控制台上的输出相同:
"[{Timestamp:HH:mm:ss} {Level:u3}] {EventId} {Message:lj} {Properties}{NewLine}{Exception}{NewLine}")
产生该输出:
[18:10:03 INF] { Id: 2 } Request finished in 876.4304ms 200
text/plain; charset=utf-8 {ElapsedMilliseconds=876.4304,
StatusCode=200, ContentType="text/plain; charset=utf-8",
SourceContext="Microsoft.AspNetCore.Hosting.Internal.WebHost",
RequestId="0HLL72NNJ19OK:00000001", RequestPath="/geo/allmenu",
CorrelationId=null, ConnectionId="0HLL72NNJ19OK"}
我的 graylog 接收器配置:
var graylogConfig = new GraylogSinkConfiguration
{
Host = "10.1.1.100",
Port = 12201,
UseSecureConnection = false,
UseAsyncLogging = true,
GraylogTransportType = GraylogTransportType.Tcp,
RetryCount = 20,
PropertyPrefix = "webapi",
};
不幸的是,我在 graylog 接收器中看不到任何丰富的数据,并且想知道如何为这个接收器提供格式化程序?