Stefan Stranger's Blog

Using Replace Function in Kusto Query Language

2019-05-16 00:00:00 +0000 ·

I wanted to replace some string values in one of my Log Analytics Kusto queries and had some difficulty to get the result I was looking for.

In this blog post I’ll demonstrate how I got the wanted results.

The Kusto Query language has an replace function which replaces all regex matches with another string.

// Example on replacing strings
datatable(Age:string,FirstName:string,LastName:string)
[
"50","Stefan","Stranger",
"40","John", "Doe",
"30","Jane", "Doe",
]
| extend NewAge=replace(@'50', @'45', Age)
| extend NewAge=replace(@'40', @'35', NewAge)
| extend NewAge=replace(@'30', @'25', NewAge)

With above Kusto Query you can replace string values from your data set.

Kusto Query

Hope this was helpfull.









  • About
  • Contact
  • Search
  • Powered by Jekyll using the Trio theme