can i increase the message length in trackTrace to more than 32768 characters, telemetry,appInsights

Toseef Ajmeri (AU) 40 Reputation points
2024-01-05T02:35:21.4866667+00:00

i am using Telemetry.TrackTrace to log messages from my application

in some cases we have messages that exceed the 32768 character limit,

which truncates the message and saves only 32768 characters in the log

is there a way to increase the message limit to be more than 32768 char,

if yes, is there a way to do it in the code files, just asking as we need only messages logged from specific functions to have a limit more than 32768 chars

will there be any cost implications on this one.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,970 questions
0 comments No comments
{count} votes

Accepted answer
  1. RevelinoB 3,675 Reputation points
    2024-01-05T05:25:38.06+00:00

    Hi Toseef,

    While the 32,768-character limit for individual log messages in Application Insights cannot be directly increased in your code, you might consider the following suggestions:

    • Custom Telemetry Processor: Develop a custom telemetry processor to handle your specific requirements. This approach would involve intercepting telemetry data before sending it to Application Insights, checking message lengths, and taking action if they exceed your desired limit. However, implementing this can be intricate and may require additional development effort.
    • Split Messages: Splitting long messages into smaller chunks and logging each part as a separate telemetry item is an option. You can include a custom property to connect related chunks for later analysis.
    • External Storage: For exceptionally large messages, you might want to store them in an external system or database. Then, you can log a reference or identifier in your telemetry data to retrieve and analyze the full message when needed. Regarding costs, remember that Azure Application Insights pricing is typically based on data ingestion volume and retention settings. Storing large messages for extended periods can result in additional costs, so it's essential to consider how your specific use case might affect expenses.

    Ultimately, your decision should balance the need for detailed logging with the associated costs and performance implications, keeping your project's specific requirements in mind.

    I hope this helps with your query?

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. SnehaAgrawal-MSFT 22,706 Reputation points Moderator
    2024-02-02T08:47:49.3766667+00:00

    Adding further here- The message has the highest allowed limit of 32768. For items in the property collection, value has max limit of 8192.

    To fit your data within these limits, you can try one of the following options:

    0 comments No comments

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.