Can Azure Application Insights stop getting logs for specific application / tag for JDK in runtime?

Stephen Li 40 Reputation points
2024-05-13T14:22:15.59+00:00

Hi,

I have several spring boot applications which use the same application insights. When one of the applications has problem, there will be a lot of exception logs. I want the application insights ignores the logs from this applications until the problem is solved.

If there is no method to ignore the logs from the application, is there any way to stop sending logs from the application by configuring in runtime?

Thanks,
Stephen

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
2,863 questions
{count} votes

Accepted answer
  1. Ben Gimblett 3,655 Reputation points Microsoft Employee
    2024-05-14T14:06:55.28+00:00

    Some additional notes here :-

    There's a cap you can set on the Log Analytics workspace - but this is an overall cap and we recommend a single Log Analytics workspace (usually per environment as a starting point) for all App Insights resources. So this is not going to work as the cap would impact all and all types of telemetry

    The other option is to look at sampling. The recommendation is to have an App Insights resource "per app, per environment" (as noted above each App Insights resource in a given environment usually points back at a single Log Analytics workspace) in this way you get a clearer view "per app" about what's going on

    Sampling would allow you to reduce the rate of ingestion for a given telemetry type through config (and that includes exceptions) as described here for Java https://learn.microsoft.com/en-us/azure/azure-monitor/app/java-standalone-sampling-overrides

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. AnuragSingh-MSFT 20,596 Reputation points
    2024-05-14T10:57:25.9366667+00:00

    @Stephen Li, thank you for posting the question here on Microsoft Q&A.

    The short answer to this question is - no, it can't be done during application runtime.

    Application Insights is either loaded to JVM using the -javaagent parameter to JVM or during application start in main() method as documented here - Using Azure Monitor Application Insights with Spring Boot. It persists during that instance of application run.

    Also, I dont think stopping the collection log (if possible) would be a good idea, as it would hinder the ability of diagnosing and troubleshooting the application. One of the use cases of AppInsights is to be able to collect these exceptions and asssist in troubleshooting.

    Is there a specific scenario why you would want the telemetry collection to be disabled from your application, when it errors out?

    Please let me know if you have any questions.

    0 comments No comments