SOLVED
Home

Event Log - Windows Services

%3CLINGO-SUB%20id%3D%22lingo-sub-673437%22%20slang%3D%22en-US%22%3EEvent%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-673437%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20guys%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20a%20rookie%20on%20Log%20Analytics%2C%20that's%20why%20I%20followed%20these%20interesting%20posts%20of%26nbsp%3B%3CSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F9172%22%20target%3D%22_blank%22%3E%40Stanislav%20Zhelyazkov%3C%2FA%3E%26nbsp%3B%3A%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E-%20%3CA%20href%3D%22https%3A%2F%2Fcloudadministrator.net%2F2018%2F01%2F24%2Fmonitoring-windows-services-sates-with-log-analytics%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EURL1%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E-%20%3CA%20href%3D%22https%3A%2F%2Fcloudadministrator.net%2F2018%2F06%2F08%2Faggregate-on-more-than-one-column-for-azure-log-search-alerts%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3EURL2%3C%2FA%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%20it%20does%20not%20meet%20completely%20my%20need.%20All%20night%20my%20Azure%20VMs%20are%20shut%20down%2C%20at%20differents%20hours%20according%20to%20project.%20As%20you%20know%2C%20Shut%20down%20generates%20Windows%20services%20stopped%20event.%3C%2FP%3E%3CP%3EI%20would%20like%20to%20exclude%20these%20events%20with%20my%20query.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20to%20join%20Event%20with%20HeartBeat%2C%20and%20compare%20TimeGenerated%20with%20LastHeartBeat%20or%20set%20value%3D1%20when%20VM%20are%20up.%26nbsp%3BBut%20in%20spite%20of%20my%20effort%2C%20it%20doesn't%20works%20...%3C%2FP%3E%3CP%3EIs%20it%20possible%20to%20do%20this%20only%20with%20Kusto%20query%20%3F%20And%20Do%20you%20have%20some%20examples%20%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EMy%20last%20query%20%3A%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3EEvent%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BEventLog%20%3D%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22System%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BEventID%20%3D%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E7036%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BSource%20%3D%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22Service%20Control%20Manager%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eparse%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bkind%3Drelaxed%20EventData%20with%20*%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'%3CDATA%20name%3D%22%26quot%3Bparam1%26quot%3B%22%3E'%3C%2FDATA%3E%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWindows_Service_Name%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CDATA%20name%3D%22%26quot%3Bparam2%26quot%3B%22%3E'%3CDIV%3E%3CSPAN%3EWindows_Service_State%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E'%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDATA%3E'%3CSPAN%3E%26nbsp%3B*%3C%2FSPAN%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWindows_Service_Name%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Econtains%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%5BSERVICE_NAME%5D%22%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eand%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWindows_Service_State%20%3D%3D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3E%22%5BSERVICE_STATE%5D%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BComputer%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWindows_Service_Name%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BWindows_Service_State%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BTimeGenerated%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%3Ejoin%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3Bkind%3D%20inner%20%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EHeartbeat%20%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20Computer%20%3C%2FSPAN%3E%3CSPAN%3Econtains%3C%2FSPAN%3E%20%3CSPAN%3E%22%5BVM%20NAME%5D%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%3CSPAN%3E%20LastHeartBeat%3Dmax%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3ETimeGenerated%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%20%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20Computer%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Esummarize%3C%2FSPAN%3E%20%3CSPAN%3Ecount%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3ELastHeartBeat%20%26gt%3B%20ago%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3E5%3C%2FSPAN%3E%3CSPAN%3Em%3C%2FSPAN%3E%3CSPAN%3E))%3C%2FSPAN%3E%20%3CSPAN%3Eby%3C%2FSPAN%3E%3CSPAN%3E%20Computer%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E)%3C%2FSPAN%3E%20%3CSPAN%3Eon%3C%2FSPAN%3E%3CSPAN%3E%26nbsp%3BComputer%3C%2FSPAN%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3EThank%20you%20very%20much%20for%20your%20help%2C%3C%2FDIV%3E%3CLINGO-LABS%20id%3D%22lingo-labs-673437%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Log%20Analytics%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EQuery%20Language%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-673503%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-673503%22%20slang%3D%22en-US%22%3EYour%20query%20looks%20great.%20%3CBR%20%2F%3EI%20didn't%20understand%20in%20the%20Hearbeat%20part%20why%20you%20aggregate%20twice%20on%20Computer%20one%20after%20the%20other.%20Consider%20using%20the%20extend%20operator%20instead.%3CBR%20%2F%3E%3CBR%20%2F%3EOther%20comments%3A%3CBR%20%2F%3E%3CBR%20%2F%3E-%20Prefer%20using%20%22has%22%20and%20not%20%22contain%22%20where%20possible%3CBR%20%2F%3E-%20You%20can%20use%20%22let%22%20to%20set%20up%20the%20constants%20in%20the%20query.%3CBR%20%2F%3E-%20You%20might%20want%20to%20use%20%22kind%3Dleftouter%22%20in%20your%20join%20to%20handle%20cases%20of%20no%20Heartbeat.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EHope%20it%20helps%2C%3CBR%20%2F%3EMeir%20%3A%26gt%3B%3C%2Fimg%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-673728%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-673728%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F84435%22%20target%3D%22_blank%22%3E%40Meir%20Mendelovich%3C%2FA%3E%26nbsp%3Bthank%20you%20very%20much%20for%20all%20these%20tips%2C%20certainly%20I%20will%20improve%20my%20syntax.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHowever%2C%20I%20think%20it's%20more%20a%20logical%20problem...%20Both%20queries%20(%20Event%20%26amp%3B%20HeartBeat%20)%20don't%20share%20the%20same%20temporality.%20The%20first%20one%2C%20filter%20only%20on%20my%20specific%20services%20event.%20The%20second%20part%20determine%20if%20my%20VM%20is%20online%20or%20not%20...%3C%2FP%3E%3CP%3EIn%20conclusion%2C%20when%20my%20VM%20is%20online%20all%20my%20events%20are%20set%20to%201%20and%20I%20can't%20dissociate%20real%20stopped%20event%2C%20and%20events%20generated%20by%20our%20shut%20down.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EResult%20%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20865px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117327iD3AC5365031D7796%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Logs%20Analytics%20-%20result.png%22%20title%3D%22Logs%20Analytics%20-%20result.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-673838%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-673838%22%20slang%3D%22en-US%22%3EI'm%20not%20sure%20what%20are%20you%20trying%20to%20find.%20Are%20you%20looking%20for%20machines%20that%20doesn't%20have%20Heartbeat%20and%20you%20don't%20have%20shut%20down%20event%20for%20them%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-674640%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-674640%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F84435%22%20target%3D%22_blank%22%3E%40Meir%20Mendelovich%3C%2FA%3E%26nbsp%3BSorry%20for%20misunderstanding.%3C%2FP%3E%3CP%3EIn%20fact%20I%20would%20like%20to%20monitored%20stopped%20events%20for%20particular%20services%20but%20also%20exclude%20these%20events%20when%20they%20are%20generated%20just%20after%20a%20shut%20down.%3C%2FP%3E%3CP%3EBecause%2C%20it's%20just%20a%20normal%20behaviour%20and%20not%20due%20to%20an%20issue.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-677138%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-677138%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20guys%2C%3C%2FP%3E%3CP%3EI%20drew%20a%20schema%20in%20order%20to%20explain%20my%20purpose%20%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20694px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F117441i8FEBF0673745726F%2Fimage-dimensions%2F694x324%3Fv%3D1.0%22%20width%3D%22694%22%20height%3D%22324%22%20alt%3D%22Logs%20Analytics%20issue.jpg%22%20title%3D%22Logs%20Analytics%20issue.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-680040%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-680040%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3ESorry%20for%20not%20being%20able%20to%20respond%20earlier%20here%20and%20on%20my%20blog.%20I%20do%20not%20think%20the%20case%20that%20you%20want%20to%20achieve%20is%20possible%20with%20just%20queries.%20In%20any%20case%20I%20think%20even%20when%20you%20create%20the%20query%20it%20might%20result%20in%20false%20positives%20and%20if%20it%20happens%20regularly%20it%20will%20beat%20the%20purpose.%20I%20think%20the%20most%20logical%20thing%20to%20do%20is%20to%20have%20some%20automation%20that%20disables%20alerts%20when%20maintenance%20window%20starts%20and%20enables%20them%20when%20it%20finishes.%20If%20you%20have%20machines%20in%20different%20maintenance%20windows%20it%20will%20be%20best%20if%20you%20create%20alerts%20for%20each%20group%20as%20you%20can%20enable%2Fdisable%20them%20independently.%20You%20may%20also%20have%20a%20function%20that%20represents%20a%20static%20or%20dynamic%20list%20of%20all%20machines.%20You%20alert%20query%20will%20filter%20on%20that%20list.%20Before%20maintenance%20window%20starts%20you%20update%20that%20query%20via%20some%20automation%20to%20remove%20the%20machine%20that%20are%20in%20that%20windows%20and%20once%20the%20windows%20stops%20you%20return%20them%20back%20by%20updating%20the%20function.%20The%20latter%20scenario%20I%20haven't%20tested%20as%20until%20recently%20for%20Log%20Analytics%20alerts%20there%20was%20message%20(in%20the%20docs)%20that%20functions%20are%20not%20supported%20of%20being%20used%20in%20alert%20queries.%20That%20message%20seems%20to%20be%20removed%20but%20it%20is%20unknown%20if%20this%20is%20due%20to%20adding%20that%20support%20or%20just%20the%20documentation%20was%20updated.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20provides%20you%20with%20clear%20path.%3C%2FP%3E%0A%3CP%3EAlso%20keep%20in%20mind%20that%20the%20article%20was%20published%20when%20Azure%20Change%20tracking%20solution%20was%20tracking%20start%20and%20stopped%20services%20every%2030%20mins%20at%20minimum.%20The%20current%20release%20allows%20you%20to%20lower%20that%20to%2030%20seconds.%20In%20case%20you%20need%20faster%20data%20on%20those%20events%20I%20would%20suggest%20using%20the%20Change%20tracking%20solution.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-803251%22%20slang%3D%22en-US%22%3ERe%3A%20Event%20Log%20-%20Windows%20Services%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-803251%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Stanislav%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EPlease%20excuse%20the%26nbsp%3Bdelay%20in%20replying.%20Thank%20you%20very%20much%20for%20your%20answer.%20It's%20very%20clear%20and%20complete.%3C%2FP%3E%3CP%3ENow%20thank%20to%20you%2C%20i%20have%20a%20method%20to%20reach%20my%20goal.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHave%20a%20nice%20day%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENicolas%2C%3C%2FP%3E%3C%2FLINGO-BODY%3E
Naexz
Occasional Contributor

Hello guys,

 

I'm a rookie on Log Analytics, that's why I followed these interesting posts of @Stanislav Zhelyazkov : 

- URL1

- URL2

 

However it does not meet completely my need. All night my Azure VMs are shut down, at differents hours according to project. As you know, Shut down generates Windows services stopped event.

I would like to exclude these events with my query.

 

I tried to join Event with HeartBeat, and compare TimeGenerated with LastHeartBeat or set value=1 when VM are up. But in spite of my effort, it doesn't works ...

Is it possible to do this only with Kusto query ? And Do you have some examples ?

 

My last query :

Event
where EventLog == "System" and EventID == 7036 and Source == "Service Control Manager"
parse kind=relaxed EventData with * '<Data Name="param1">' Windows_Service_Name '</Data><Data Name="param2">'
Windows_Service_State '</Data>' *
where Windows_Service_Name contains "[SERVICE_NAME]" and Windows_Service_State == "[SERVICE_STATE]"
project Computer, Windows_Service_Name, Windows_Service_State, TimeGenerated
join kind= inner (
Heartbeat
| where Computer contains "[VM NAME]"
| summarize LastHeartBeat=max(TimeGenerated) by Computer
| summarize count(LastHeartBeat > ago(5m)) by Computer
) on Computer 
 
Thank you very much for your help,
7 Replies
Your query looks great.
I didn't understand in the Hearbeat part why you aggregate twice on Computer one after the other. Consider using the extend operator instead.

Other comments:

- Prefer using "has" and not "contain" where possible
- You can use "let" to set up the constants in the query.
- You might want to use "kind=leftouter" in your join to handle cases of no Heartbeat.


Hope it helps,
Meir :>

@Meir Mendelovich thank you very much for all these tips, certainly I will improve my syntax. 

 

However, I think it's more a logical problem... Both queries ( Event & HeartBeat ) don't share the same temporality. The first one, filter only on my specific services event. The second part determine if my VM is online or not ...

In conclusion, when my VM is online all my events are set to 1 and I can't dissociate real stopped event, and events generated by our shut down.

 

Result :

Logs Analytics - result.png

 

 

I'm not sure what are you trying to find. Are you looking for machines that doesn't have Heartbeat and you don't have shut down event for them?

@Meir Mendelovich Sorry for misunderstanding.

In fact I would like to monitored stopped events for particular services but also exclude these events when they are generated just after a shut down.

Because, it's just a normal behaviour and not due to an issue. 

Hello guys,

I drew a schema in order to explain my purpose :

 

Logs Analytics issue.jpg

 

 

Solution

Hi,

Sorry for not being able to respond earlier here and on my blog. I do not think the case that you want to achieve is possible with just queries. In any case I think even when you create the query it might result in false positives and if it happens regularly it will beat the purpose. I think the most logical thing to do is to have some automation that disables alerts when maintenance window starts and enables them when it finishes. If you have machines in different maintenance windows it will be best if you create alerts for each group as you can enable/disable them independently. You may also have a function that represents a static or dynamic list of all machines. You alert query will filter on that list. Before maintenance window starts you update that query via some automation to remove the machine that are in that windows and once the windows stops you return them back by updating the function. The latter scenario I haven't tested as until recently for Log Analytics alerts there was message (in the docs) that functions are not supported of being used in alert queries. That message seems to be removed but it is unknown if this is due to adding that support or just the documentation was updated.

 

I hope this provides you with clear path.

Also keep in mind that the article was published when Azure Change tracking solution was tracking start and stopped services every 30 mins at minimum. The current release allows you to lower that to 30 seconds. In case you need faster data on those events I would suggest using the Change tracking solution.

Hello Stanislav,

 

Please excuse the delay in replying. Thank you very much for your answer. It's very clear and complete.

Now thank to you, i have a method to reach my goal.

 

Have a nice day,

 

Nicolas,