Waldemar
Waldemar

Reputation: 65

how to reduce rows to 1 row by concatenate in Azure Log Analytics

Is it possible to reduce rows to 1 row? Rows should be joined with a comma. As a result I expect

Upvotes: 0

Views: 398

Answers (2)

AjayKumarGhose
AjayKumarGhose

Reputation: 4893

One of the workaround could able to solve the above issue,

To concatenate we can use this for e.g | extend New_Column = strcat(tagname,",", tagvalue) with comma between two string.

For example we have tested in our environment with tag name and tag value

  resourcecontainers      
    | where type =~ 'microsoft.resources/subscriptions'
    | extend tagname = tostring(bag_keys(tags)[0])
    | extend tagvalue = tostring(tags[tagname])
    | extend New_Column = strcat(tagname,",", tagvalue) // for concate two rows into one with comma between two string

Here is the sample output for reference: enter image description here

enter image description here

For more information please refer this SO THREAD

UPDATE: To cancat the rows we tried with the example of code as stated in the given SO THREAD which is suggested by @Yoni L.

| summarize result = strcat_array(make_list(word), ",")

Sample output for reference: enter image description here

Upvotes: 1

Waldemar
Waldemar

Reputation: 65

thanks for the tips. in your links I found: | summarize result = strcat_array(make_list(name_s), ",")

Upvotes: 0

Related Questions