Application Insight自定义属性无法通过OMS连接器同步的技术咨询
I’ve run into this exact issue before, so let’s break down the most common fixes and checks to get your custom properties (like that critical correlation ID) showing up in OMS:
1. Double-Check Your Connector’s Sync Scope
First, head over to your OMS workspace’s Application Insights Connector settings. Make sure you’ve selected all the log types that include your custom properties—things like Trace, Exception, and Warning logs. Sometimes the default setup only syncs a subset of log categories, so your custom data might be getting left out entirely.
2. Validate Custom Property Format & Naming
OMS can be picky about property names. Avoid spaces, special characters (except underscores), and overly long names. Stick to lowercase or camelCase (e.g., correlation_id instead of Correlation ID with Spaces). Also, make sure your properties are stored as flat key-value pairs—nested objects in customDimensions won’t get parsed correctly by the connector.
3. Account for Sync Delay
Don’t panic if you don’t see data immediately! The sync between Application Insights and OMS typically takes 15-30 minutes, and sometimes longer on initial setup. Wait at least an hour before assuming something’s broken, especially if you just configured the connector.
4. Query OMS Logs to Verify Data
Use Kusto queries in OMS Log Analytics to check if the custom properties are actually making it over. For trace logs, run:
AppTraces | where CustomDimensions has "correlationId" | project TimeGenerated, Message, CustomDimensions
If you see your correlationId in the CustomDimensions column, the sync is working—you just might need to adjust how you’re filtering or visualizing the data. If nothing comes up, move to the next check.
5. Confirm Custom Properties Exist in Application Insights
Before blaming the connector, verify your app is actually writing the properties correctly. Go to your Application Insights resource’s Logs tab and run:
traces | where customDimensions has "correlationId" | project timestamp, message, customDimensions
If this query returns no results, the problem is in your application code. For example, in .NET, make sure you’re passing properties to the tracking method properly:
var telemetry = new TelemetryClient(); var customProps = new Dictionary<string, string> { { "correlationId", "your-unique-id" } }; telemetry.TrackTrace("API request completed", SeverityLevel.Information, customProps);
Double-check that you’re not accidentally omitting the properties parameter in TrackTrace, TrackError, or TrackWarning.
6. Check Permissions & Resource Alignment
Ensure your Application Insights resource and OMS workspace are in the same Azure tenant—cross-tenant syncs can fail silently. Also, confirm your user account has Contributor or Reader access to both resources. If the connector shows a "Disconnected" status, try deleting and re-creating it to refresh the connection.
If you’ve gone through all these steps and still don’t see your custom properties, reach out to Azure Support with your resource IDs and sample logs—they can dig into backend sync issues that aren’t visible to end-users.
内容的提问来源于stack exchange,提问作者krishnakumar

