Search code examples
azure-application-insightsms-app-analytics

Filter Custom Dimension with Period in Property Name


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 

Solution

  • 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://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/schema-entities/entity-names#reference-identifiers-in-queries

    • Identifiers names that include special characters (such as -) must be enclosed using [' and '] or using [" and "].
    • Identifier names that are language keywords must be enclosed using [' and '] or [" and "].
    • Identifier names that are literals must be enclosed using [' and '] or [" and "].
    • Note: Identifiers are case-sensitive. For example, you can't refer to a table called ThisTable as thisTABLE.