in src/Elastic.CommonSchema.Serilog/LogEventConverter.cs [313:345]
private static Http? GetHttp(LogEvent e, IEcsTextFormatterConfiguration configuration)
{
if (e.TryGetScalarPropertyValue(SpecialKeys.HttpContext, out var httpContext)
&& httpContext.Value is HttpContextEnrichments enriched)
return enriched.Http;
var http = configuration.MapHttpAdapter?.Http;
if (e.TryGetScalarString(SpecialKeys.Method, out var method) || e.TryGetScalarString(SpecialKeys.RequestMethod, out method))
{
http ??= new Http();
http.RequestMethod = method;
}
if (e.TryGetScalarString(SpecialKeys.RequestId, out var requestId))
{
http ??= new Http();
http.RequestId = requestId;
}
if (e.TryGetScalarPropertyValue(SpecialKeys.StatusCode, out var statusCode))
{
http ??= new Http();
http.ResponseStatusCode = statusCode.Value is int s ? s : null;
}
if (e.TryGetScalarString(SpecialKeys.ContentType, out var contentType))
{
http ??= new Http();
http.ResponseMimeType = contentType;
}
return http;
}