SOLVED

Combine different time generated data

%3CLINGO-SUB%20id%3D%22lingo-sub-160504%22%20slang%3D%22en-US%22%3ECombine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160504%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20running%20some%20performance%20testing%20against%20Service%20Fabric%20application%20and%20capturing%20the%20counter%20values%20and%20rendering%20the%20report%20of%20utilization%20of%20different%20components%20from%20Log%20Analytics.%3C%2FP%3E%0A%3CP%3ETill%20now%20I%20was%20able%20to%20generate%20for%20a%20single%20timeline%2C%20but%20now%20I%20need%20to%20compare%20different%20test%20I%20have%20conducted%20over%20different%20timelines.%3C%2FP%3E%0A%3CP%3EFor%20example%2C%3C%2FP%3E%0A%3CDIV%20style%3D%22color%3A%20%23000000%3B%20background-color%3A%20%23fffffe%3B%20font-family%3A%20Consolas%2C%20'Courier%20New'%2C%20monospace%3B%20font-weight%3A%20normal%3B%20font-size%3A%2014px%3B%20line-height%3A%2016px%3B%20white-space%3A%20pre%3B%22%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Esearch%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20not(ObjectName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22Advisor%20Metrics%22%3C%2FSPAN%3E%20%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eor%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20ObjectName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22ManagedSpace%22%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eand%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20CounterName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22%25%20Processor%20Time%22%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eand%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20Computer%20startswith_cs%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22NT1%22%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Esummarize%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eby%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20Computer%2C%20bin(TimeGenerated%2C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%2309885a%3B%22%3E1%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3Em)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Esort%3C%2FSPAN%3E%20%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eby%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20TimeGenerated%20desc%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Ewhere%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20TimeGenerated%20%26gt%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Edatetime%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E(%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22DATEVALUE%22%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E)%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Eand%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E%20TimeGenerated%20%26lt%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%230000ff%3B%22%3Edatetime%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E(%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23a31515%3B%22%3E%22DATEVALUE%22%3C%2FSPAN%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3EI%20have%20got%20another%20set%20of%20data%20which%20is%20fetched%20by%20changing%20the%20TimeGenerated%20values%20and%20these%20two%20are%20two%20different%20report.%20%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3EWhat%20I%20need%20is%20to%20have%20a%20single%20report%20to%20show%20CPU%20utilization%20of%20different%20timelines.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%3CSPAN%20style%3D%22color%3A%20%23000000%3B%22%3EI%20tried%20with%20OR%20in%20the%20where%20condition%20but%20they%20lay%20one%20after%20another%20as%20the%20time%20is%20different.%3C%2FSPAN%3E%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%0A%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-160504%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-160637%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160637%22%20slang%3D%22en-US%22%3EMeir%20is%20correct.%20Almost%20never%20use%20search.%20I%20personally%20use%20it%20if%20I%20need%20to%20explore%20something%20but%20once%20I%20am%20starting%20to%20construct%20the%20query%20I%20am%20referencing%20the%20table%2Fs%20directly.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-160631%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160631%22%20slang%3D%22en-US%22%3ERegardless%20of%20the%20problem%20that%20Stanislav%20called%20out%2C%20you%20should%20not%20use%20%22search%22%20at%20the%20beginning%20of%20the%20query.%20Instead%2C%20you%20should%20use%20the%20table%20name%3A%3CBR%20%2F%3EPerf%3CBR%20%2F%3E%7C%20where%20ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20and%20Computer%20startswith_cs%20%22NT1%22%3CBR%20%2F%3E%3CBR%20%2F%3EIt%20would%20make%20your%20query%20much%20more%20efficient%20and%20predictable.%3CBR%20%2F%3E%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-160628%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160628%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20charts%20in%20the%20Analytics%20portal%20does%20not%20support%20aggregating%20on%20two%20fields%20and%20being%20visible%20at%20the%20same%20time.%20With%20this%20you%20will%20have%20to%20do%20some%20workarounds.%20Also%20if%20you%20want%20to%20place%20the%20results%20on%20top%20of%20each%20other%20you%20will%20have%20to%20alter%20time%20time%20line.%20Here%20is%20example%20below%3A%3C%2FP%3E%0A%3CPRE%3Elet%20result1%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20%0A%20%20%20%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20%0A%20%20%20%20and%20Computer%20startswith_cs%20%22NT1%22%20%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20Computer%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%0A%7C%20extend%20CommonTime%20%3D%20TimeGenerated%20%2B%2012h%0A%7C%20extend%20Result%20%3D%20strcat(Computer%2C%20'_result1')%3B%0Alet%20result2%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20%0A%20%20%20%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20%0A%20%20%20%20and%20Computer%20startswith_cs%20%22NT1%22%20%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20Computer%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%0A%7C%20extend%20CommonTime%20%3D%20TimeGenerated%0A%7C%20extend%20Result%20%3D%20strcat(Computer%2C%20'_result2')%3B%0Aresult1%20%7C%20union%20result2%20%7C%20summarize%20avg()%20by%20Result%2C%20bin(CommonTime%2C%201m)%20%3C%2FPRE%3E%0A%3CP%3ENow%20first%20let%20me%20say%20that%20it%20is%20easier%20for%20me%20to%20think%20if%20the%20aggregation%20is%20on%20Computer%20field%20rather%20counter%20field%20so%20I've%20replaced%20that.%20Also%20as%20you%20do%20not%20want%20to%20join%20results%20but%20rather%20have%20the%20same%20results%20into%20single%20table%20union%20function%20should%20be%20used.%20Next%20notice%20that%20I%20am%20extending%20result1%20with%20CommonTime%20column%20which%20will%20have%20the%20time%20of%20the%20records%20%2B%2012%20hours.%20In%20your%20case%20you%20will%20have%20to%20replace%2012%20hours%20with%20value%20on%20your%20own%20in%20a%20way%20that%20the%20results%20from%20result%201%20will%20be%20in%20the%20same%20timeline%20as%20result2.%26nbsp%3B%20For%20example%20if%20results1%20are%20from%2017th%20of%20February%20between%2002%3A00%20and%2010%3A00%20and%20the%20results2%20are%20from%2018th%20of%20February%20between%2002%3A00%20and%2010%3A00%20you%20will%20have%20to%20add%20%2B%2024h.%26nbsp%3B%20I%20hope%20you%20understand%20the%20example.%20Next%20also%20I%20am%20creating%20another%20column%20so%20when%20the%20computer%20name%20is%20the%20same%20we%20can%20differentiate%20it%20from%20which%20results%20it%20is%20coming.%20That%20way%20we%20can%20later%20summarize%20on%20that%20column.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20this%20helps%20and%20matches%20what%20you%20want%20to%20achieve.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-160589%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160589%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20problem%20lies%20around%20selecting%20the%20series%20from%20the%20list.%20The%20table%20has%20all%20the%20required%20data%20but%20when%20it%20comes%20to%20chart%20rendering%20I%20can%20select%20only%20one%20of%20the%20timeline%20at%20time.%20Even%20if%20I%20have%20an%20option%20to%20select%20two%20them%2C%20they%20will%20not%20overlap%20in%20the%20chart%20as%20they%20have%20different%20time%20data.%3C%2FP%3E%0A%3CP%3EMy%20requirement%20is%20to%20render%20different%20time%20data%20in%20the%20same%20chart%20and%20compare%20them%2C%3C%2FP%3E%0A%3CP%3EFor%20example%2C%3C%2FP%3E%0A%3CP%3Eresult01%20%3D%20Avg%20Process%20Time%20between%209%3A00%20AM%20to%2010%3A00%20AM%3C%2FP%3E%0A%3CP%3Eresult02%20%3D%20Avg%20Process%20Time%20between%202%3A00%20PM%20to%203%3A00%20PM%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EGet%20these%20results%20to%20render%20in%20the%20same%20chart%20with%20series%20grouped%20based%20on%20the%20results%20on%20the%20same%20timeline.%3C%2FP%3E%0A%3CP%3EIs%20it%20something%20possible%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-160585%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160585%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Stanislav%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%20for%20your%20reply%2C%20it%20helped%20partially%20and%20got%20some%20insights%20on%20joining%20results.%3C%2FP%3E%0A%3CP%3EWith%20the%20current%20query%20the%20problem%20is%20both%20the%20results%20will%20have%20a%20single%20line%20in%20chart%2C%20basically%20I%20am%20trying%20to%20plot%20them%20in%20chart%20showing%20the%20variance.%20With%20the%20join%20the%20data%20grouping%20is%20lost%20and%20they%20all%20fall%20within%20the%20same%20series.%3C%2FP%3E%0A%3CP%3EQuery%20below%20and%20attached%20a%20screenshot%20of%20the%20chart%20where%20it%20renders%20without%20the%20series%20grouping.%3C%2FP%3E%0A%3CPRE%3Elet%20result1%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20%0A%20%20%20%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20%0A%20%20%20%20and%20Computer%20startswith_cs%20%22NT1%22%20%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20CounterName%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%3B%0Alet%20result2%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20%0A%20%20%20%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20%0A%20%20%20%20and%20Computer%20startswith_cs%20%22NT1%22%20%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20CounterName%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%3B%0Aresult1%20%7C%20join%20kind%3D%20inner%20(%0A%20%20%20result2%20%0A)%20on%20CounterName%3C%2FPRE%3E%0A%3CP%3EIs%20there%20anyway%20that%20I%20can%20plot%20the%20results%20in%20two%20different%20lines%20in%20the%20line%20chart%3F%3C%2FP%3E%0A%3CP%3EThank%20you%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-160546%22%20slang%3D%22en-US%22%3ERe%3A%20Combine%20different%20time%20generated%20data%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-160546%22%20slang%3D%22en-US%22%3E%3CP%3EHi%3C%2FP%3E%0A%3CP%3EIf%20you%20want%20to%20get%20the%20results%20from%20two%20timelines%20and%20join%20them%20you%20just%20need%20to%20use%20let%20and%20join%20functions.%20You%20get%20the%20first%20results%20in%20a%20let%2C%20the%20second%20results%20on%20a%20let%20and%20after%20that%20you%20perform%20join%20on%20them%20by%20a%20command%20field%20like%20Computer.%20If%20needed%20you%20can%20join%20on%20more%20than%20one%20field.%20Example%20based%20on%20your%20query%3A%3C%2FP%3E%0A%3CPRE%3Elet%20Result1%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20and%20Computer%20startswith_cs%20%22NT1%22%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20Computer%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%3B%0Alet%20Result2%20%3D%20search%20not(ObjectName%20%3D%3D%20%22Advisor%20Metrics%22%20or%20ObjectName%20%3D%3D%20%22ManagedSpace%22)%20and%20CounterName%20%3D%3D%20%22%25%20Processor%20Time%22%20and%20Computer%20startswith_cs%20%22NT1%22%0A%7C%20summarize%20Avg_ProcessorTime%20%3D%20avg(CounterValue)%20by%20Computer%2C%20bin(TimeGenerated%2C%201m)%20%0A%7C%20sort%20by%20TimeGenerated%20desc%0A%7C%20where%20TimeGenerated%20%26gt%3B%20datetime(%22DATEVALUE%22)%20and%20TimeGenerated%20%26lt%3B%20datetime(%22DATEVALUE%22)%3B%0AResult1%20%7C%20join%20kind%3Dinner%20%0A(%0AResult2%0A)%0Aon%20Computer%3C%2FPRE%3E%0A%3CP%3EHope%20this%20helps.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Deleted
Not applicable

I am running some performance testing against Service Fabric application and capturing the counter values and rendering the report of utilization of different components from Log Analytics.

Till now I was able to generate for a single timeline, but now I need to compare different test I have conducted over different timelines.

For example,

search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace")
and CounterName == "% Processor Time"
and Computer startswith_cs "NT1"
| summarize Avg_ProcessorTime = avg(CounterValue) by Computer, bin(TimeGenerated, 1m)
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE")
 
I have got another set of data which is fetched by changing the TimeGenerated values and these two are two different report.
What I need is to have a single report to show CPU utilization of different timelines.
I tried with OR in the where condition but they lay one after another as the time is different.
 
 
6 Replies

Hi

If you want to get the results from two timelines and join them you just need to use let and join functions. You get the first results in a let, the second results on a let and after that you perform join on them by a command field like Computer. If needed you can join on more than one field. Example based on your query:

let Result1 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") and CounterName == "% Processor Time" and Computer startswith_cs "NT1"
| summarize Avg_ProcessorTime = avg(CounterValue) by Computer, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE");
let Result2 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") and CounterName == "% Processor Time" and Computer startswith_cs "NT1"
| summarize Avg_ProcessorTime = avg(CounterValue) by Computer, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE");
Result1 | join kind=inner 
(
Result2
)
on Computer

Hope this helps.

 

 

Hi Stanislav,

 

Thanks for your reply, it helped partially and got some insights on joining results.

With the current query the problem is both the results will have a single line in chart, basically I am trying to plot them in chart showing the variance. With the join the data grouping is lost and they all fall within the same series.

Query below and attached a screenshot of the chart where it renders without the series grouping.

let result1 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") 
    and CounterName == "% Processor Time" 
    and Computer startswith_cs "NT1" 
| summarize Avg_ProcessorTime = avg(CounterValue) by CounterName, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE");
let result2 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") 
    and CounterName == "% Processor Time" 
    and Computer startswith_cs "NT1" 
| summarize Avg_ProcessorTime = avg(CounterValue) by CounterName, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE");
result1 | join kind= inner (
   result2 
) on CounterName

Is there anyway that I can plot the results in two different lines in the line chart?

Thank you,

 

The problem lies around selecting the series from the list. The table has all the required data but when it comes to chart rendering I can select only one of the timeline at time. Even if I have an option to select two them, they will not overlap in the chart as they have different time data.

My requirement is to render different time data in the same chart and compare them,

For example,

result01 = Avg Process Time between 9:00 AM to 10:00 AM

result02 = Avg Process Time between 2:00 PM to 3:00 PM

 

Get these results to render in the same chart with series grouped based on the results on the same timeline.

Is it something possible?

 

Best Response
Solution

The charts in the Analytics portal does not support aggregating on two fields and being visible at the same time. With this you will have to do some workarounds. Also if you want to place the results on top of each other you will have to alter time time line. Here is example below:

let result1 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") 
    and CounterName == "% Processor Time" 
    and Computer startswith_cs "NT1" 
| summarize Avg_ProcessorTime = avg(CounterValue) by Computer, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE")
| extend CommonTime = TimeGenerated + 12h
| extend Result = strcat(Computer, '_result1');
let result2 = search not(ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") 
    and CounterName == "% Processor Time" 
    and Computer startswith_cs "NT1" 
| summarize Avg_ProcessorTime = avg(CounterValue) by Computer, bin(TimeGenerated, 1m) 
| sort by TimeGenerated desc
| where TimeGenerated > datetime("DATEVALUE") and TimeGenerated < datetime("DATEVALUE")
| extend CommonTime = TimeGenerated
| extend Result = strcat(Computer, '_result2');
result1 | union result2 | summarize avg() by Result, bin(CommonTime, 1m) 

Now first let me say that it is easier for me to think if the aggregation is on Computer field rather counter field so I've replaced that. Also as you do not want to join results but rather have the same results into single table union function should be used. Next notice that I am extending result1 with CommonTime column which will have the time of the records + 12 hours. In your case you will have to replace 12 hours with value on your own in a way that the results from result 1 will be in the same timeline as result2.  For example if results1 are from 17th of February between 02:00 and 10:00 and the results2 are from 18th of February between 02:00 and 10:00 you will have to add + 24h.  I hope you understand the example. Next also I am creating another column so when the computer name is the same we can differentiate it from which results it is coming. That way we can later summarize on that column.

 

I hope this helps and matches what you want to achieve.

Regardless of the problem that Stanislav called out, you should not use "search" at the beginning of the query. Instead, you should use the table name:
Perf
| where ObjectName == "Advisor Metrics" or ObjectName == "ManagedSpace") and CounterName == "% Processor Time" and Computer startswith_cs "NT1"

It would make your query much more efficient and predictable.

Meir :>
Meir is correct. Almost never use search. I personally use it if I need to explore something but once I am starting to construct the query I am referencing the table/s directly.