3

Following this guide, I see how to filter on custom dimensions but how do I filter when there is a '.' in the key / property name?

For example, I want to filter on ServiceFabric.ServiceTypeName from this custom dimension value:

{
    "AspNetCoreEnvironment": "Production",
    "ServiceFabric.ApplicationTypeName": "MyCompany.MyAppType",
    "ServiceFabric.ServiceTypeName": "MyService",
    "ServiceFabric.ApplicationName": "fabric:/MyCompany.MyApp",
    "ServiceFabric.PartitionId": "some-guid",
    "ServiceFabric.ServiceName": "fabric:/MyCompany.MyApp/MyService",
    "ServiceFabric.InstanceId": "55555",
    "ServiceFabric.NodeName": "my-node",
    "CategoryName": "Microsoft.AspNetCore.Hosting.Internal.WebHost",
    "Protocol": "HTTP/1.1",
    "Host": "MyCompany.com",
    "Method": "GET",
    "Scheme": "https",
    "Path": "/api/values"
}

The following is not working...

traces
| extend type = customDimensions.ServiceFabric.ApplicationTypeName
| where type == "MyCompany.MyAppType"
| order by timestamp  desc 
spottedmahn
  • 14,823
  • 13
  • 108
  • 178

1 Answers1

9

the syntax for names with special things is:

customDimensions["ServiceFabric.ApplicationTypeName"]

you can use that bracket+quotes thing to name columns as well:

| extend ["This is a column with spaces"] = blah

or

| project-rename ["Name with space"] = name

from: https://docs.loganalytics.io/docs/Learn/References/Naming-principles

  • Entity names that include special characters must be quoted using [' and '] or using [" and "]
  • Entity names that are language keywords must be quoted quoted using [' and '] or using [" and "]
John Gardner
  • 24,225
  • 5
  • 58
  • 76
  • Any chance you know where that is documented? – spottedmahn Apr 11 '18 at 18:07
  • 1
    the only place i can find that syntax *explicitly* documented is on dynamic https://docs.loganalytics.io/docs/Language-Reference/Data-types/dynamic . I've requested internally for it be explicitly added to `extend`, `project`, etc, or more generically somewhere that explains escaping of column names, because yeah, i can't find it. – John Gardner Apr 11 '18 at 19:36
  • 1
    found it! https://docs.loganalytics.io/docs/Learn/References/Naming-principles (AI and LA share the same underlying database technology, only the schemas are different) – John Gardner Apr 11 '18 at 21:11
  • Really appreciate you digging that up! FYI, I submitted a [PR](https://github.com/MicrosoftDocs/azure-docs/pull/7088) to the docs. – spottedmahn Apr 12 '18 at 12:38
  • 1
    [Documentation updated](https://learn.microsoft.com/en-us/azure/application-insights/app-insights-analytics-tour#custom-properties-and-measurements) via [Azure Docs PR: 7088](https://github.com/MicrosoftDocs/azure-docs/pull/7088)! Thanks John! – spottedmahn Apr 17 '18 at 13:02