Forum Discussion

Deleted's avatar
Deleted
Apr 25, 2019
Solved

How to query for two events with no common fields?

Hi,   I know one can query for two events that have a common field by the Join Operator, but how can I query two or more separate events that have no common fields? I'm trying to track a couple of...
  • CliveWatson's avatar
    CliveWatson
    Apr 29, 2019

    Deleted 

     

    Thanks, that extra Table name and info really helps, I didn't have any 'ALLOW' activities, so line 5 will need changing to match your test.  Hopefully this change is easy to understand, essentially I've created a variable to store when we get a success/match in either table and JOIN on that.

     

    Tip: best practice is to use HAS rather than CONTAINS where possible, source.

     

     AzureDiagnostics
    |where TimeGenerated > ago(1d)
    |where Category == "AzureFirewallNetworkRule"
    |where OperationName == "AzureFirewallNetworkRuleLog"
    |where msg_s startswith "TCP request from " and msg_s endswith "Action: Deny"  // change this line back - used to test 
    |project Category , OperationName , msg_s , set_flag =1   // set a flag when we find a match 
    |join
     (SecurityEvent
    | where Activity == "4688 - A new process has been created." 
    | where Process == "diskperf.exe" 
    | project Activity ,Computer ,Process , set_flag =1  // set a flag when we find a match 
    ) on set_flag  // join on that flag

Resources