I'm using Azure
App Insight
as a logging tool and store log data by the following code:
private void SendTrace(LoggingEvent loggingEvent)
{
loggingEvent.GetProperties();
string message = "TestMessage";
var trace = new TraceTelemetry(message)
{
SeverityLevel = SeverityLevel.Information
};
trace.Properties.Add("TetstKey", "TestValue");
var telemetryClient = new TelemetryClient();
telemetryClient.Context.InstrumentationKey = this.InstrumentationKey;
telemetryClient.Track(trace);
}
everything works well. I see logged record in App insight
as well as in App insight analytics
(in trace
table). My custom attributes are written in special app insight row section - customDimensions
. For example, the above code will add new attribute with "TestKey" key and "TestValue" value into customDimensions
section.
But when I try to write some big text (for example JSON
document with more then 15k letters) I still can do it without any exceptions, but the writable text will be cut off after some document length. As the result, the custom attribute value in customDimensions
section will be cropped too and will have only first part of document.
As I understand there is the restriction for max text length which is allowed to be written in app insight custom attribute.
Could someone know how can I get around with this?
答案 0 :(得分:4)
message
的最大限制为32768。对于属性集合中的项目,值的最大限制为8192。
因此,您可以尝试以下选项之一:
将数据拆分为多个,然后分别添加到属性集合中。
例如:
trace.Properties.Add(“ key_part1”,“ Bigtext1_upto8192”);
trace.Properties.Add(“ key_part2”,“ Bigtext2_upto8192”);