I am trying to create a watchlist that displays specific alerts from different business units

%3CLINGO-SUB%20id%3D%22lingo-sub-2488823%22%20slang%3D%22en-US%22%3EI%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2488823%22%20slang%3D%22en-US%22%3E%3CP%3Ehere%20is%20the%20query%20below.%26nbsp%3B%20I%20would%20like%20to%20be%20able%20to%20determine%20which%20specific%20business%20unit%20server%20an%20alert%20was%20generated%20into%20Azure%20sentinel%20but%20I%20am%20unable%20to%20create%20a%20tag%20that%20includes%20a%20watchlist%20that%20provides%20the%20expected%20result.%26nbsp%3B%20Please%20help%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHeartbeat%3C%2FP%3E%3CP%3E%7C%20lookup%20kind%3Dleftouter%20_GetWatchlist('MBSFQDN_01')%3C%2FP%3E%3CP%3E%26nbsp%3Bon%20%24left.Computer%20%3D%3D%20%24right.SearchKey%3C%2FP%3E%3CP%3E%7C%20project%20UNIT%2C%20Computer%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2493544%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2493544%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1024104%22%20target%3D%22_blank%22%3E%40caitlin2250%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHello!%20You've%20posted%20your%20question%20in%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FCommunity-Discussion%2Fbd-p%2FCommunityQuestions%22%20target%3D%22_blank%22%3ETech%20Community%20Discussion%20space%2C%3C%2FA%3E%20which%20is%20intended%20for%20discussion%20around%20the%20Tech%20Community%20website%20itself%2C%20not%20product%20questions.%20I'm%20moving%20your%20question%20to%20the%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fwindows-10%2Fbd-p%2FWindows10space%22%20target%3D%22_self%22%3EWindows%2010%20space%3C%2FA%3E-%20please%20post%20Windows%2010%20questions%20here%20in%20the%20future.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2494091%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2494091%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1024104%22%20target%3D%22_blank%22%3E%40caitlin2250%3C%2FA%3E%26nbsp%3BThe%20code%20looks%20correct%2C%20what%20is%20the%20error%20you%20are%20getting%20or%20is%20it%20just%20missing%20data%3F%26nbsp%3B%20You%20have%20all%20the%20fields%20you%20require%20in%20the%20watchlist%2C%20right%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2495648%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2495648%22%20slang%3D%22en-US%22%3EHi%20Eric.%20Thank%20you%20very%20much%20for%20the%20direction.%20Much%20appreciated%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2495751%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2495751%22%20slang%3D%22en-US%22%3EHi%20Gary%2C%20Thanks%20for%20confirming%20that%20the%20code%20looks%20correct.%20I%20do%20not%20get%20any%20error.%20Yes%20it's%20just%20missing%20data%20that%20I%20am%20finding%20difficult%20to%20add%20on%20to%20the%20code.%20I%20would%20like%20for%20example%20for%20the%20Watchlist%20to%20include%20severs%20also%20not%20from%20the%20same%20business%20unit%20and%20be%20able%20to%20identify%20specific%20alerts%20from%20those%20servers%20also%20distinctively.%20At%20the%20moment%20I%20have%20only%20been%20able%20pull%20out%20information%20from%20servers%20within%20one%20business%20unit%20with%20this%20Watchlist%20and%20it%20does%20not%20meet%20the%20requirement%2C%20Hope%20I%20have%20explained%20it%20better.%20Thank%20you%20very%20much%20for%20taking%20the%20time%20to%20respond.%20Very%20much%20appreciated%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2496069%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2496069%22%20slang%3D%22en-US%22%3EHi%20Caitlin%3CBR%20%2F%3EJust%20thinking%20out%20loud%20here%3A%3CBR%20%2F%3ECould%20it%20be%20possible%20that%20the%20computers%20in%20your%20watchlist%20are%20lowercase%20and%20in%20the%20logs%20are%20uppercase%20(or%20a%20mix).%20And%20there%20for%20now%20having%20a%20match%20and%20not%20showing%20the%20data.%3CBR%20%2F%3ECould%20a%20tolower()%20be%20a%20solution%20when%20setting%20up%20the%20join%3F%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2496283%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2496283%22%20slang%3D%22en-US%22%3EHi%20Luis%20thanks%20for%20the%20reply%2C%20maybe%20I%20wasn%E2%80%99t%20with%20my%20explanation%3CBR%20%2F%3EI%20need%20assistance%20in%20developing%20a%20KQL%20query%20that%20would%20add%20the%20extra%20property%20for%20Heartbeats.%3CBR%20%2F%3EThe%20additional%20property%20would%20be%20the%20Team%20that%20manages%20the%20VM.%3CBR%20%2F%3ELet's%20say%20I%20have%20100%20VMs%20managed%20by%20five%20teams.%3CBR%20%2F%3EWhen%20I%20run%20the%20Heartbeat%20KQL%20query%2C%20I%20would%20like%20to%20see%20the%20team%20or%20business%20unit%20name%20that%20manages%20the%20VM.%3CBR%20%2F%3EMy%20approach%20is%20to%20use%20a%20Watchlist%20with%20two%20columns.%20One%20column%20would%20be%20the%20Computer%2C%20and%20another%20column%20would%20be%20the%20name%20of%20the%20Team%20or%20business%20unit%20that%20owns%20the%20VM.%20So%20I%20would%20have%20five%20teams%20in%20the%20column%20Team%20or%20business%20unit%20and%20the%20list%20of%20computers%20assigned%20to%20each%20Team%20or%20business%20unit.%3CBR%20%2F%3EThe%20Computer%20will%20be%20a%20search%20key.%3CBR%20%2F%3EThe%20query%20I%20am%20planning%20to%20use%20is%3CBR%20%2F%3EHeartbeat%3CBR%20%2F%3E%7C%20lookup%20kind%3Dleftouter%20_GetWatchlist('UNIT')%3CBR%20%2F%3Eon%20%24left.Computer%20%3D%3D%20%24right.SearchKey%3CBR%20%2F%3EAfter%20the%20query%20is%20complete%2C%20I%20would%20like%20to%20save%20it%20as%20a%20function.%3CBR%20%2F%3EIs%20it%20the%20right%20approach%2C%20or%20you%20could%20suggest%20something%20better%3F%3CBR%20%2F%3EMany%20Thanks%3CBR%20%2F%3ECaitlin%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2496480%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2496480%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1024104%22%20target%3D%22_blank%22%3E%40caitlin2250%3C%2FA%3E%26nbsp%3BYour%20code%20looks%20correct.%26nbsp%3B%20If%20you%20want%20to%20save%20it%20as%20a%20function%2C%20you%20can%20easily%20do%20that%20through%20the%20Logs%20UI.%26nbsp%3B%20%26nbsp%3BThere%20is%20no%20parameter%20(aka%20filter)%20so%20you%20will%20get%20the%20full%20list%20each%20time%20if%20that%20is%20your%20intention.%26nbsp%3B%20%26nbsp%3B%20Otherwise%20it%20looks%20like%20it%20will%20work%20just%20fine.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20would%20think%20about%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F585791%22%20target%3D%22_blank%22%3E%40LouisMastelinck%3C%2FA%3E%26nbsp%3Bcomment%20about%20case%20sensitivity%20though.%26nbsp%3B%20Granted%20using%20%22%3D~%22%20takes%20more%20processing%20so%20I%20would%20double%20check%20all%20the%20entries%20in%20the%20Heartbeat%20table%20to%20make%20sure%20they%20are%20in%20the%20case%20you%20are%20expecting.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2496483%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2496483%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1024104%22%20target%3D%22_blank%22%3E%40caitlin2250%3C%2FA%3E%26nbsp%3BI%20don't%20see%20any%20reason%20why%20you%20would%20only%20get%20the%20one%20business%20unit%20returned.%26nbsp%3B%20%26nbsp%3BIf%20you%20could%20paste%20some%20of%20the%20entries%20from%20your%20watchlist%20(changing%20the%20data%20to%20protect%20your%20machine%20names%20of%20course)%2C%20it%20may%20help.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2500607%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2500607%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1024104%22%20target%3D%22_blank%22%3E%40caitlin2250%3C%2FA%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EThis%20should%20work.%26nbsp%3B%20%26nbsp%3BI%20did%20note%20I%20couldn't%20use%20%22Team%22%20as%20a%20column%20name%20but%20%22%3CSTRONG%3ETeam_%3C%2FSTRONG%3E%22%20worked.%26nbsp%3B%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-06-30%20083631.png%22%20style%3D%22width%3A%20456px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F292502i099A709922C08AE2%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-06-30%20083631.png%22%20alt%3D%22Screenshot%202021-06-30%20083631.png%22%20%2F%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3EWatchlist%20used%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Screenshot%202021-06-30%20083738.png%22%20style%3D%22width%3A%20958px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F292503iF577E7645FAAD99B%2Fimage-size%2Flarge%3Fv%3Dv2%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screenshot%202021-06-30%20083738.png%22%20alt%3D%22Screenshot%202021-06-30%20083738.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eor%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-cpp%22%3E%3CCODE%3EHeartbeat%0A%7C%20lookup%20kind%3Dleftouter%20_GetWatchlist('UNIT')%0Aon%20%24left.Computer%20%3D%3D%20%24right.SearchKey%0A%7C%20summarize%20thoseInaTeam%3Dmake_set_if(Computer%2C%20isnotempty(Team_))%2C%20dcountif(Computer%2C%20isnotempty(Team_))%2C%20thoseNotInaTeam%3Dmake_set_if(Computer%2C%20isempty(Team_))%2C%20dcountif(Computer%2C%20isempty(Team_))%20by%20Team_%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CDIV%3E%0A%3CTABLE%20cellspacing%3D%221%22%20cellpadding%3D%225%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTH%3ETeam_%3C%2FTH%3E%0A%3CTH%3EthoseInaTeam%3C%2FTH%3E%0A%3CTH%3Edcountif_Computer%3C%2FTH%3E%0A%3CTH%3EthoseNotInaTeam%3C%2FTH%3E%0A%3CTH%3Edcountif_Computer1%3C%2FTH%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3E%26nbsp%3B%3C%2FTD%3E%0A%3CTD%3E%5B%5D%3C%2FTD%3E%0A%3CTD%3E0%3C%2FTD%3E%0A%3CTD%3E%5B%22TASARINT201201.fabrikamltd.co.uk%22%2C%22THAMLOCFKOM19.fabrikamltd.co.uk%22%2C%22TASARINT201601.fabrikamltd.co.uk%22%2C%22THAMLOCFKARC01.fabrikamltd.co.uk%22%2C%22THAMLOCPFKWVM01.fabrikamltd.co.uk%22%2C%22THAMLOCFKVMM19.fabrikamltd.co.uk%22%2C%22GENETEC201601.fabrikamltd.co.uk%22%2C%22RDS2019.fabrikamltd.co.uk%22%2C%22ATACENTER.fabrikamltd.co.uk%22%2C%22THAMLOCPFKWVM04.fabrikamltd.co.uk%22%2C%22VMRUBUNTU01%22%2C%22GENETEC201602.fabrikamltd.co.uk%22%2C%22WIN10MS-0.fabrikamltd.co.uk%22%2C%22WIN7.fabrikamltd.co.uk%22%2C%22VMW2019VM01.fabrikamltd.co.uk%22%2C%22powlo-signage%22%2C%22powloexpmegan%22%2C%22powloexpmeganc%22%5D%3C%2FTD%3E%0A%3CTD%3E18%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3EDEV%3C%2FTD%3E%0A%3CTD%3E%5B%22thamlocfkubu01%22%2C%22THAMUKSOBS01%22%5D%3C%2FTD%3E%0A%3CTD%3E2%3C%2FTD%3E%0A%3CTD%3E%5B%5D%3C%2FTD%3E%0A%3CTD%3E0%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3EAKS_DEV%3C%2FTD%3E%0A%3CTD%3E%5B%22aks-agentpool-40245457-vmss000009%22%2C%22aks-agentpool-40245457-vmss00000a%22%5D%3C%2FTD%3E%0A%3CTD%3E2%3C%2FTD%3E%0A%3CTD%3E%5B%5D%3C%2FTD%3E%0A%3CTD%3E0%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3EAKS_PROD%3C%2FTD%3E%0A%3CTD%3E%5B%22aks-agentpool-40245457-vmss000001%22%2C%22aks-agentpool-40245457-vmss000000%22%5D%3C%2FTD%3E%0A%3CTD%3E2%3C%2FTD%3E%0A%3CTD%3E%5B%5D%3C%2FTD%3E%0A%3CTD%3E0%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%3EPROD%3C%2FTD%3E%0A%3CTD%3E%5B%22vmrcentos01%22%5D%3C%2FTD%3E%0A%3CTD%3E1%3C%2FTD%3E%0A%3CTD%3E%5B%5D%3C%2FTD%3E%0A%3CTD%3E0%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2500715%22%20slang%3D%22en-US%22%3ERe%3A%20I%20am%20trying%20to%20create%20a%20watchlist%20that%20displays%20specific%20alerts%20from%20different%20business%20units%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2500715%22%20slang%3D%22en-US%22%3EHi%20Clive%3CBR%20%2F%3EThank%20you%20very%20much%20for%20the%20code%20provided.%20That%20is%20very%20helpful%20indeed.%20I%20will%20add%20information%20need%20from%20my%20end%20to%20the%20code%20and%20feedback.%20Much%20appreciated%3C%2FLINGO-BODY%3E
Occasional Contributor

here is the query below.  I would like to be able to determine which specific business unit server an alert was generated into Azure sentinel but I am unable to create a tag that includes a watchlist that provides the expected result.  Please help 

 

Heartbeat

| lookup kind=leftouter _GetWatchlist('MBSFQDN_01')

 on $left.Computer == $right.SearchKey

| project UNIT, Computer

20 Replies

@caitlin2250 

Hello! You've posted your question in the Tech Community Discussion space, which is intended for discussion around the Tech Community website itself, not product questions. I'm moving your question to the Azure Sentinel space- please post Azure Sentinel questions here in the future. 

@caitlin2250 The code looks correct, what is the error you are getting or is it just missing data?  You have all the fields you require in the watchlist, right?

Hi Eric. Thank you very much for the direction. Much appreciated
Hi Gary, Thanks for confirming that the code looks correct. I do not get any error. Yes it's just missing data that I am finding difficult to add on to the code. I would like for example for the Watchlist to include severs also not from the same business unit and be able to identify specific alerts from those servers also distinctively. At the moment I have only been able pull out information from servers within one business unit with this Watchlist and it does not meet the requirement, Hope I have explained it better. Thank you very much for taking the time to respond. Very much appreciated
Hi Caitlin
Just thinking out loud here:
Could it be possible that the computers in your watchlist are lowercase and in the logs are uppercase (or a mix). And there for now having a match and not showing the data.
Could a tolower() be a solution when setting up the join?
Hi Luis thanks for the reply, maybe I wasn’t with my explanation
I need assistance in developing a KQL query that would add the extra property for Heartbeats.
The additional property would be the Team that manages the VM.
Let's say I have 100 VMs managed by five teams.
When I run the Heartbeat KQL query, I would like to see the team or business unit name that manages the VM.
My approach is to use a Watchlist with two columns. One column would be the Computer, and another column would be the name of the Team or business unit that owns the VM. So I would have five teams in the column Team or business unit and the list of computers assigned to each Team or business unit.
The Computer will be a search key.
The query I am planning to use is
Heartbeat
| lookup kind=leftouter _GetWatchlist('UNIT')
on $left.Computer == $right.SearchKey
After the query is complete, I would like to save it as a function.
Is it the right approach, or you could suggest something better?
Many Thanks
Caitlin

@caitlin2250 Your code looks correct.  If you want to save it as a function, you can easily do that through the Logs UI.   There is no parameter (aka filter) so you will get the full list each time if that is your intention.    Otherwise it looks like it will work just fine.

 

I would think about @LouisMastelinck comment about case sensitivity though.  Granted using "=~" takes more processing so I would double check all the entries in the Heartbeat table to make sure they are in the case you are expecting.

@caitlin2250 I don't see any reason why you would only get the one business unit returned.   If you could paste some of the entries from your watchlist (changing the data to protect your machine names of course), it may help.

@caitlin2250 

This should work.   I did note I couldn't use "Team" as a column name but "Team_" worked. 
Screenshot 2021-06-30 083631.png

Watchlist used:
Screenshot 2021-06-30 083738.png

or

Heartbeat
| lookup kind=leftouter _GetWatchlist('UNIT')
on $left.Computer == $right.SearchKey
| summarize thoseInaTeam=make_set_if(Computer, isnotempty(Team_)), dcountif(Computer, isnotempty(Team_)), thoseNotInaTeam=make_set_if(Computer, isempty(Team_)), dcountif(Computer, isempty(Team_)) by Team_

 

Team_ thoseInaTeam dcountif_Computer thoseNotInaTeam dcountif_Computer1
  [] 0 ["TASARINT201201.fabrikamltd.co.uk","THAMLOCFKOM19.fabrikamltd.co.uk","TASARINT201601.fabrikamltd.co.uk","THAMLOCFKARC01.fabrikamltd.co.uk","THAMLOCPFKWVM01.fabrikamltd.co.uk","THAMLOCFKVMM19.fabrikamltd.co.uk","GENETEC201601.fabrikamltd.co.uk","RDS2019.fabrikamltd.co.uk","ATACENTER.fabrikamltd.co.uk","THAMLOCPFKWVM04.fabrikamltd.co.uk","VMRUBUNTU01","GENETEC201602.fabrikamltd.co.uk","WIN10MS-0.fabrikamltd.co.uk","WIN7.fabrikamltd.co.uk","VMW2019VM01.fabrikamltd.co.uk","powlo-signage","powloexpmegan","powloexpmeganc"] 18
DEV ["thamlocfkubu01","THAMUKSOBS01"] 2 [] 0
AKS_DEV ["aks-agentpool-40245457-vmss000009","aks-agentpool-40245457-vmss00000a"] 2 [] 0
AKS_PROD ["aks-agentpool-40245457-vmss000001","aks-agentpool-40245457-vmss000000"] 2 [] 0
PROD ["vmrcentos01"] 1 [] 0

 

Hi Clive
Thank you very much for the code provided. That is very helpful indeed. I will add information need from my end to the code and feedback. Much appreciated
Hello Louis,
Thank you for the suggestion regarding case insensitive. I am afraid I am new to KQL so how do I incorporate that in this query below

Heartbeat
| lookup kind=leftouter _GetWatchlist('DEV1')
on $left.Computer == $right.SearchKey
| project UNIT, Computer

Will really appreciate you help with it. Look forward to hearing from you.
Thanks
Caitlin

Just as an example you could do something like below to change the Computer column to all upper case. (ComputerUpper just being what ever you want to name it.) You would need to to the same with your right column whatever that is if it also has lower case letters. You can use toupper or tolower, as long as both columns end up uniform.

Replacing the == with =~ wont work as the join only supports equalities.

Heartbeat
| extend ComputerUpper = toupper (Computer)
| lookup kind=leftouter _GetWatchlist('DEV1')
on $left.ComputerUpper == $right.SearchKey
| project UNIT, ComputerUpper

Hello Jbub_Arbala, Thanks for the reply I have tried your query and the only problem I am seeing in the result is that it is only devices with uppercase naming in the result of the query. What I am looking for is to get both whether the name of the server is in uppercase or lowercase.
Thanks and look forward to hearing from you
Caitlin

@caitlin2250 
union - is case insensitive 

let watchListUnit = (_GetWatchlist('UNIT') | project Team_, Computer);
watchListUnit
| union 
(
    Heartbeat
    | distinct Computer
) 
| summarize thoseInaTeam=make_set_if(Computer, isnotempty(Team_)), dcountif(Computer, isnotempty(Team_)), thoseNotInaTeam=make_set_if(Computer, isempty(Team_)), dcountif(Computer, isempty(Team_)) by Team_


 

Hello Clive thanks for the reply. Could you please explain what this query does so that I can understand and tweak it to suit what I am trying to achieve. Look forward to hearing from you

Kind regards
Caitlin

@caitlin2250 

I'm using a Union rather than a join or a lookup (like in the previous examples), which skips the need to have case equality (where both the data in the Watchlist and the Computer have to be upper or lowercase for a Join/lookup to match them).
The query is essentially the same (you can replace the summarize line with whatever suits your use case).

This server highlighted in the red box, is all upper case in the Heartbeat table, but in the unit watchlist I made the "tham" characters lowercase to prove that you can union a mix of upper/lower cases.  The server is now in the "thoseInaTeam" column as thamUKSOBS01 was matched with THAMUKSOBS01 and it was recognised as a DEV team server, regardless of its case sensitivity.  

Screenshot 2021-07-04 090433.png
I hope this helps.  


fyi, there is a KQL course and the modules from the course you can access from within the portal (the modules have lots of great examples), see below. 
Also Module 7 of the Azure Sentinel training Become an Azure Sentinel Ninja: The complete level 400 training - Microsoft Tech Community
Screenshot 2021-07-04 091655.png

Hello Luis. Your example works for me for my requirement due to simplicity but can you please explain what each line of code does so that I can have a clear understanding of it. Look forward to hearing from you. Thanks Caitlin

Hi @caitlin2250 

 

I don't have your dataset but I was thinking something like this:

Heartbeat
| extend ComputerUpper = toupper (Computer)
| lookup kind=leftouter _GetWatchlist('DEV1')
on  tolower($left.ComputerUpper) == tolower($right.SearchKey)
| project UNIT, ComputerUpper

 

 

Give it a try if it will accept this in your syntax.