Splunk Search

Compare stats of current day with previous day

aqudoos
Explorer

Hi all!
I am currently getting stats of current day as followed
Port Count
25 25
443 75
53 990

I wanted a table like this

Port Count(Previous Day) Count(Current Day)
25 25 30
443 75 40
53 990 50

My query is like this

Index=* | stats count by port

Please confirm is it possible
Please help!

0 Karma

YoungDaniel
Path Finder

Hi,
Have you tried to use the | appendcols function? or Just append ?


Your search here 
| appendcols [ | search your search here earliest=-2d latest=-1d 
| stats count as yesterday by Port ]
| stats count as today, sum(yesterday) as yesterday by Port


OR

Your search
| eval date="newer"
| append  [ | search <your search> " earliest=-2d latest=-1d 
    |  eval date="older" 
    |  stats count by Port date ]
| stats count by Port date
0 Karma
Get Updates on the Splunk Community!

.conf25 Registration is OPEN!

Ready. Set. Splunk! Your favorite Splunk user event is back and better than ever. Get ready for more technical ...

Detecting Cross-Channel Fraud with Splunk

This article is the final installment in our three-part series exploring fraud detection techniques using ...

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...