I have a Kubernetes app that is constantly logging ServiceBusReceiver.Receive Dependency calls. It is creating 2000 logs per hour, per instance.
In the TelemtryClient there are only custom methods for TrackEvent and TrackException so these look like they are coming from somewhere else and I haven’t been able to trace it to disable or find out why its logging so much. The TrackDependency method is part of the built in Microsoft.ApplicationInsights.TelemetryClient package. I have changed versions of packages to match another messaging app I have with no luck, and also updated packages to latest versions also with no luck. There isn’t much other info in the logs to trace it.
SERVICEBUS ServiceBusReceiver.Receive
- Dependency Properties
Type: servicebus
Call status: true
Duration: 1.0 mins
Name: ServiceBusReceiver.Receive
Telemetry type: dependency
Application version: 4.19.0.0
SDK version dotnetc:2.21.0-429
Sample rate: 1
Performance: 1min-2min
Base name: ServiceBusReceiver.Receive
Other info about packages and versions installed:
- Sdk=”Microsoft.NET.Sdk”
- net6.0
- AzureFunctionsVersion v4
- “AutoMapper.Extensions.Microsoft.DependencyInjection” Version=”4.0.1″
- “Azure.Messaging.ServiceBus” Version=”7.10.0″
- “Microsoft.Azure.WebJobs.Extensions.ServiceBus” Version=”5.4.0″
- “Microsoft.Azure.WebJobs.Logging.ApplicationInsights” Version=”3.0.33″
- “Microsoft.NET.Sdk.Functions” Version=”4.0.1″
- “Microsoft.Azure.Functions.Extensions” Version=”1.1.0″
- “Microsoft.Extensions.Azure” Version=”1.2.0″
- “Microsoft.Extensions.Configuration.AzureAppConfiguration” Version=”5.1.0″
- “Microsoft.Extensions.Caching.Memory” Version=”6.0.1″
- “Polly” Version=”7.1.0″
- “Scrutor” Version=”4.1.0″
2
Answers
You cannot suppress individual logs, but you can tune the level that gets captured to reduce the noise.
By default, the Azure SDKs used in the 5.x+ extension packages will respect the global log level configuration. Each can be tuned individually to allow you to capture the level of detail that your application is interested in.
To change the log detail that you’re seeing for Service Bus and other Azure SDK packages, you need to define their level by package in your
host.json
logging section. For example, if you wanted to restrict Service Bus calls to just warnings and errors, you’d use something similar to:More information on how the Azure SDK logging configuration maps to the Functions logging can be found in the article Logging with the Azure SDK for .NET.
For that, you can write a TelemetryProcessor:
It could look like this:
Do not forget to register the processor: