Splunk Search

Search and grep for numbered events

gnovak
Builder

Hi there!

I'm looking at this previous question here:

[http://splunk-base.splunk.com/answers/2602/can-splunk-filtermatch-events-and-bring-back-neighbouring...]

I have a similar question. I have a search that brings back 8 events. They are numbered 1 through 8. My search is pretty simple and looks like this:

source="/opt/log/blahblahblah/epp_server/epp_server.log" sessionID="[10.9.231.111:59671:130.250.4.141:1000-whoohoo;]"

From this sessionID I searched for I got back 8 events. It will always be 8 events no matter what sessionID I search for.

So with that in mind I'd like to do a search sorta of like this:

[gnovak@yoogieboogie]$ seq 1 10
1
2
3
4
5
6
7
8
9
10

[gnovak@yoogieboogie]$ seq 1 10 | grep 5
5
[gnovak@yoogieboogie]$ seq 1 10 | grep -B 3 5
2
3
4
5
[gnovak@yoogieboogie]$ seq 1 10 | grep -A 3 5
5
6
7
8

I'd like to do a search in splunk on the actual "number" of the event returned. Is it possible to do that or would I have to make an eventtype for something that happens on that numbered event?

Tags (1)
0 Karma
1 Solution

eelisio2
Path Finder

Have you tried streamstats to create a sequence number?

"your search" | streamstats count as seq by sessionID | search seq > 3 AND seq < 8

View solution in original post

eelisio2
Path Finder

Have you tried streamstats to create a sequence number?

"your search" | streamstats count as seq by sessionID | search seq > 3 AND seq < 8

gnovak
Builder

No I'll give this a shot!

0 Karma
Get Updates on the Splunk Community!

Automatic Discovery Part 1: What is Automatic Discovery in Splunk Observability Cloud ...

If you’ve ever deployed a new database cluster, spun up a caching layer, or added a load balancer, you know it ...

Real-Time Fraud Detection: How Splunk Dashboards Protect Financial Institutions

Financial fraud isn't slowing down. If anything, it's getting more sophisticated. Account takeovers, credit ...

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...