Forum Discussion

Pravin Ohal's avatar
Pravin Ohal
Copper Contributor
Jun 22, 2018
Solved

Union operator return results out of sequence in Azure Log Analytics Query

Hi,        I'm working on the following query. The union will give me count of the message in out of sequence fashion always for e.g The expected behavior should be that it should return results a...
  • Hi 

    I think probably the easier solution for this is :

     

    let result1 = search in (traces) message : "New Request Received" and timestamp > ago(1d)
    | summarize count() | extend rank = 1;
    let result2 = search in (traces) message : "Listing Customers" and timestamp > ago(1d)
    | summarize count()| extend rank = 2;
    let result3 = search in (traces) message : "pqr" and timestamp > ago(1d)
    | summarize count()| extend rank = 3;
     result1 | union  result2, result3 | sort by rank asc

    Seems like union does not care on the order of how you stitch results. Probably this is done due to performance reasons.

Resources