I have a need to send data via a sub-logger that only includes specific contextual data. In this case, I am pretty much wanting to ignore everything from the Message Template (except the text itself) and pass key contextual data already added by enrichers and PushContext statements. This is mainly to create a dashboard view that stays consistant.
LevelSwitch = new LoggingLevelSwitch { MinimumLevel = LogLevelSerilog.Verbose };
Log.Logger = new LoggerConfiguration()
.MinimumLevel.ControlledBy(LevelSwitch)
.Enrich.With<CorrelationIdEnricher>()
.Enrich.With<ThreadIdEnricher>()
.Enrich.FromLogContext()
.WriteTo.Seq("http://localhost/Response")
// Filter to a sublogger for instrumentation...
.WriteTo.Logger(lc => lc.MinimumLevel.Information()
.WriteTo.Seq("http://localhost/Public")
.Filter.ByIncludingOnly(q => q.Properties.ContainsKey("Controller")
|| q.Properties.ContainsKey("Action")
|| q.Properties.ContainsKey("Class")
|| q.Properties.ContainsKey("Method")
|| q.Properties.ContainsKey("Organization")
|| q.Properties.ContainsKey("OrganizationId")
|| q.Properties.ContainsKey("CorrelationId")))
.CreateLogger();
Any ideas why this is not sending any events to the sub-logger? (Figured this out)
Any ideas why I am getting everything from the main logger (per level allowed)? I expected the filter(s) to reduce the amount of data going to the sub-logger. i.e.: I want just the filtered data to go to the sub-logger. Any added data should be stripped off of the log.