OK This is getting complicated. The idea is that for each day we add an extra day with count as zero. We then sum the counts by day, and take only the last day of the original time period index="ABC" sourcetype=XYZTimeout*
| bin span=1d _time
| stats count by PAGE_URL _time
/* create an event for following day with count = 0 */
| eval tomorrow=_time+(60*60*24)
| eval time=mvappend(_time,tomorrow)
| mvexpand time
| eval count=if(time=tomorrow,0,count)
| eval _time=time
| fields - time tomorrow
/* autoregress to get previous day's count */
| autoregress count p=1
/* set previous day's count to 0 for the first event for the PAGE_URL */
| eventstats first(_time) as firsttime by PAGE_URL
| eval count_p1=if(_time = firsttime,0,count_p1)
/* join the daily counts together */
| stats sum(count) as count sum(count_p1) as count_p1 by URL, _time
/* only keep the event for the last day of the query time */
| addinfo
| where _time=relative_time(info_max_time-1,"@d")
/* calculate the difference between the counts for the last day and the previous day */
| eval diff=count_p1 - count
| rename count as count1, count_p1 as count2
| fields PAGE_URL count1 count2 diff
| sort diff
... View more