diff --git a/src/Elastic.CommonSchema.Serilog/EcsTextFormatterConfiguration.cs b/src/Elastic.CommonSchema.Serilog/EcsTextFormatterConfiguration.cs index 19c907f3..fa92d326 100644 --- a/src/Elastic.CommonSchema.Serilog/EcsTextFormatterConfiguration.cs +++ b/src/Elastic.CommonSchema.Serilog/EcsTextFormatterConfiguration.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.IO; using Elastic.CommonSchema.Serilog.Adapters; using Serilog.Events; @@ -32,6 +33,11 @@ public interface IEcsTextFormatterConfiguration : IEcsDocumentCreationOptions /// Stop certain keys to be persisted as or /// ISet? LogEventPropertiesToFilter { get;set; } + + /// + /// Provide a to + /// + IFormatProvider? MessageFormatProvider { get; set; } } /// Provides configuration options for @@ -66,6 +72,9 @@ public class EcsTextFormatterConfiguration : IEcsTextFormatterConf /// public ISet? LogEventPropertiesToFilter { get; set; } + /// + public IFormatProvider? MessageFormatProvider { get; set; } + /// public Func? MapCustom { get; set; } } diff --git a/src/Elastic.CommonSchema.Serilog/LogEventConverter.cs b/src/Elastic.CommonSchema.Serilog/LogEventConverter.cs index 778fbbc3..565887ad 100644 --- a/src/Elastic.CommonSchema.Serilog/LogEventConverter.cs +++ b/src/Elastic.CommonSchema.Serilog/LogEventConverter.cs @@ -49,7 +49,7 @@ public static TEcsDocument ConvertToEcs(LogEvent logEvent, IEcsTex var user = GetUser(logEvent, configuration); if (user != null) ecsEvent.User = user; - ecsEvent.Message = logEvent.RenderMessage(); + ecsEvent.Message = logEvent.RenderMessage(configuration.MessageFormatProvider); ecsEvent.Log = GetLog(logEvent); ecsEvent.Agent = GetAgent(logEvent) ?? DefaultAgent; ecsEvent.Event = GetEvent(logEvent);