Forum Discussion

Peter Hall's avatar
Peter Hall
Brass Contributor
Sep 12, 2019
Solved

Calculating rate of change in Log Analytics

If I have a counter that increases over time and I want to display how much that counter is changing every minute, how would I do that.  In PromQL I would use the rate function but is there a simple equivalent KQL?

For example, 14:10:00 the total value since we collected data was 182077, at 14:11 it was 182083 and at 14:12 it was 182084.  I would like to render a graph showing 0 at 14:10, 6 at 14:11 and 1 at 14:12. 

Sounds simple but I can't see a way to do it.  Any help would be appreciated.

 

Regards

Pete

  • Peter Hall's avatar
    Peter Hall
    Sep 12, 2019

    CliveWatson you are a scholar and a gent.  That would appear to do the trick.  I'll adapt as necessary but thank you

8 Replies

    • Peter Hall's avatar
      Peter Hall
      Brass Contributor

      CliveWatson Thanks for the reply.  I have looked at that.  It's not the number of new entries per minute I am trying to ascertain, but the change in the sum of all previous entries per minute, if that makes sense.  

      ie in the above query, you'll see system mode cpu usage for computer aks-agentpool-31816283-2 goes from 264552.21 to 264560.83 in the minute, so i want the difference between those 2 on an on-going basis.  In fact, I actually want it for all modes but one step at a time.

Resources