How to stop logging the lot of unnecessary data to a Storage Account from Azure Functions executions?

krishna572 881 Reputation points
2023-03-30T14:03:24.3133333+00:00

Lot of Stack Trace is being logged in to the Application Insights instance to the Storage Account.

If an error comes like 404, 500 (Internal server Error), some request failure, timeout, response failure, etc. only the reason and the status code should be logged to the Storage account but not with the entire stack trace from been execution to being executed of Azure Function App API.

I'm thinking, it can be done on the host.json configuration.

If yes, how to do - can anyone the same scenarios from your experience.

If no, what are the other ways of preventing the logging of stack trace during execution.

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,215 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Urnun 9,826 Reputation points Microsoft Employee
    2023-04-03T19:36:09.7566667+00:00

    Hello Thanks for reaching out & posting on the MS Q&A! You're on the right that it's done in the host.json config file. You can control how much logging is sent to App Insights by setting the threshold of log level as discussed more fully in the following documentation: Configure log levels Depending on your specific use case with various bindings, there may be some additional fine-grained configurations that can be done but the doc above is a great starting point.

    I hope this helps, if you have any further questions, just let me know ;)

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.