Splunk Search

How can I search and return only the first occurrence of a string?

ferza
Explorer

I have a simple search that goes:

sessionID=UNIQUESESSIONID "connected to "

This gives me the full log or event line that contains the phrase "connected to " as I'll need to see that whole event line/log line. However, at times I can get multiple occurrences of this line, but I only need to see just one of them. Is there something I can add at the end of my search to show only the first result in the log that meets that criteria? How about something where I can pipe in that just gives one occurrence of my search?

Tags (3)
0 Karma

musskopf
Builder

Just add | head 1 after your search...

Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...