@@ -408,7 +408,7 @@ public void RecordSupportabilityMetric(string metricName, int count)
408
408
_agentHealthReporter . ReportSupportabilityCountMetric ( metricName , count ) ;
409
409
}
410
410
411
- public void RecordLogMessage ( string frameworkName , object logEvent , Func < object , DateTime > getTimestamp , Func < object , object > getLevel , Func < object , string > getLogMessage , Func < object , Exception > getLogException , Func < object , Dictionary < string , object > > getContextData , string spanId , string traceId )
411
+ public void RecordLogMessage ( string frameworkName , object logEvent , Func < object , DateTime > getTimestamp , Func < object , object > getLevel , Func < object , string > getLogMessage , Func < object , Exception > getLogException , Func < object , Dictionary < string , object > > getContextData , string spanId , string traceId )
412
412
{
413
413
_agentHealthReporter . ReportLogForwardingFramework ( frameworkName ) ;
414
414
@@ -418,6 +418,15 @@ public void RecordLogMessage(string frameworkName, object logEvent, Func<object,
418
418
{
419
419
var level = getLevel ( logEvent ) . ToString ( ) ;
420
420
normalizedLevel = string . IsNullOrWhiteSpace ( level ) ? "UNKNOWN" : level . ToUpper ( ) ;
421
+
422
+ // LogLevelDenyList is already uppercase, so don't need case-insensitive lookup
423
+ if ( _configurationService . Configuration . LogLevelDenyList . Contains ( normalizedLevel ) )
424
+ {
425
+ if ( _configurationService . Configuration . LogMetricsCollectorEnabled )
426
+ _agentHealthReporter . IncrementLogDeniedCount ( normalizedLevel ) ;
427
+
428
+ return ;
429
+ }
421
430
}
422
431
423
432
if ( _configurationService . Configuration . LogMetricsCollectorEnabled )
@@ -432,7 +441,7 @@ public void RecordLogMessage(string frameworkName, object logEvent, Func<object,
432
441
433
442
var logMessage = getLogMessage ( logEvent ) ;
434
443
var logException = getLogException ( logEvent ) ;
435
-
444
+
436
445
// exit quickly if the message and exception are missing
437
446
if ( string . IsNullOrWhiteSpace ( logMessage ) && logException is null )
438
447
{
0 commit comments