Select a Custom Dimension as a Column in KQL

Selecting a custom dimension means extracting a value from the dynamic field and showing it as a normal column.

Basic Example

If your logs contain a custom dimension called UserId, use this query:

 
traces
| project
    timestamp,
    message,
    UserId = tostring(customDimensions["UserId"])

What this does:

  • Reads the value using square brackets.
  • Converts it to a string.
  • Creates a new column named UserId.

You can select multiple custom dimensions in the same query:

 
requests
| project
    timestamp,
    name,
    Region  = tostring(customDimensions["Region"]),
    OrderId = tostring(customDimensions["OrderId"])

Tips

  • Always use tostring() unless you know the value is numeric or boolean.
  • Rename the extracted value to keep your results readable.
  • Use project to control exactly what columns appear in the output.

This pattern is ideal for building reports or exporting data because it turns hidden metadata into visible columns that anyone can understand.

KQL
dynamic
extract
logs
howto

Comments