Splunk Search

How to reverse the order of displayed events?

the_wolverine
Champion

Got this question today from someone who needs to reverse the order of the search results for their troubleshooting purposes.

Tags (1)

the_wolverine
Champion

By default, Splunk displays your search results from most recent to oldest. You can reverse the order by appending your search with '| reverse'. For example:

sourcetype=foo | reverse

HeinzWaescher
Motivator

Hi,

thanks for your explanation! Then the " | reverse " function will fit my needs in most of the cases.

0 Karma

sowings
Splunk Employee
Splunk Employee

Try it. You'll find that sort - _time doesn't deal with events that have the same time stamp in the same way as reverse. Reverse literally flips the event stream top to bottom, but the sort might leave "simultaneous" events in the original "new stuff on top" order. This is probably only meaningful if you have an event stream that is part of a transaction, and you're used to reading it in "log" order.

HeinzWaescher
Motivator

Hi,

what is the difference between " | reverse " and "| sort - _time " ? I would expect the same effect?

0 Karma

jrodman
Splunk Employee
Splunk Employee

Note that this reversal is not free. For smaller numbers of events, it will be totally fine. For millions of events it is some significant amount of work.

Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...