Splunk Search

How to find out the event with max duration?

chhawu
New Member

How to find out the event with max duration?
I used command transaction to group events and I want to find out the event with max duration.

0 Karma
1 Solution

HiroshiSatoh
Champion

Details are unknown, but ...
・・・・|transaction ・・・・|stats max(duration)
OR
・・・・|transaction ・・・・|sort -duration|head 1

View solution in original post

0 Karma

akocak
Contributor

Selected answer correct for if you have one field name, for multiple similarly I use:

|sort - duration
|dedup field_name
0 Karma

HiroshiSatoh
Champion

Details are unknown, but ...
・・・・|transaction ・・・・|stats max(duration)
OR
・・・・|transaction ・・・・|sort -duration|head 1

0 Karma

chhawu
New Member

You are right ! I try to search with second search script to get the longest transaction,but is there any way to show column one "max(duration)" and column two _raw at once?

0 Karma

Richfez
SplunkTrust
SplunkTrust

Instead of doing the ... | head 1, try instead using the limit=<number> parameter of the sort. Then to make it pretty or include other fields, use the table command.

... | transaction ...stuff...  |table duration, _raw  | sort limit=1 - duration 

Give that a shot and see if it works for you.

Happy Splunking!
Rich

chhawu
New Member

Hi Rich

Thanks ! I am going to modify my search script base on your suggestion.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...