Skip to main content
Solved

Graph at What Time a Service Reached 1,000 Total Requests, or When a Service

  • December 24, 2025
  • 5 replies
  • 8 views

This message originated from Cribl Community Slack.
Click here to view the original link.

Is there a way to do a cumulative sum on log events in Search? Or even with metrics? I'm not seeing anything mentioning cumulative in the stats functions in the docs. I would like to graph at what time a service reached 1,000 total requests, or when a service first had 100 unique clients IPs. I currently only have the events with this data, but if I need to convert these to metrics in Stream and send them over to Search as well I can, I'm just not sure Search supports cumulative queries

Best answer by David Cavuto

< @U09Q6L9G69Y > here's an example: ```dataset="cribl_search_sample" dataSource=access* | limit 100 | sort by _time asc // important to sort before you use the prev() function | project _time, bytes | extend cumulativeSum=prev(cumulativeSum,1,0)+bytes. // adds the previous 1 value of cumulativeSum to the current value, initializing to 0 | extend threshold=iff(cumulativeSum>100000,true,false) // add whatever logic you want here```

5 replies

  • Employee
  • December 24, 2025
You should be able to use the `prev()` window function to compute the cumulative sum using the same value from the previous single event. Take a look at the docs and see if that's helpful. Ping us back either way, thanks! < a href="https://docs.cribl.io/search/prev/" target="_blank" >https://docs.cribl.io/search/prev/< /a >

  • Employee
  • Answer
  • December 24, 2025
< @U09Q6L9G69Y > here's an example: ```dataset="cribl_search_sample" dataSource=access* | limit 100 | sort by _time asc // important to sort before you use the prev() function | project _time, bytes | extend cumulativeSum=prev(cumulativeSum,1,0)+bytes. // adds the previous 1 value of cumulativeSum to the current value, initializing to 0 | extend threshold=iff(cumulativeSum>100000,true,false) // add whatever logic you want here```

  • Author
  • New Participant
  • December 24, 2025
Yes! `prev()` was what I was missing, thank you!

Links for this message:
image.png

  • Author
  • New Participant
  • December 24, 2025
Didn't see the default value parameter of `prev()` which would have simplified this a bit but I got exactly what I was looking for

  • Employee
  • December 24, 2025
Happy to help!