Splunk Search

Is it possible to run two separate searches on a Inputlookup CSV to use the first/last X amount of results?

UMDTERPS
Communicator

I am looking to run two searches on a CSV, one that looks at the first 35,000 results and another that looks at the last 35,000 results. The easiest way to solve the problem would be to increase the subsearch limit to 100,000, however, the admin is refusing to do so. Another way would be to chop the CSV in half and run the same search twice.

Is there a command or search in Splunk that can look at the first 35,000 results and another that looks at the last 35,000 results of a lookup?

Would using head and tail be the best way? (however, the total results may change every day/week)

Thanks!

0 Karma
1 Solution

UMDTERPS
Communicator

Okay, figured it out:

|inputlookup ip_dump.csv 
| streamstats count("IP Address") as row_number
| where row_number <= 50000
| append [
    |inputlookup ip_dump.csv 
    | streamstats count("IP Address") as row_number
    | where row_number > 50000]

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Totally untested, but you might try this.

| multisearch [|inputlookup something.csv | head 35000] [|inputlookup something.csv | tail 35000] | ...
---
If this reply helps you, Karma would be appreciated.
0 Karma

UMDTERPS
Communicator

I think the union command can be used too?:

| union maxout=10000000
[ search index=union_1 | head 60000]
[ search index=union_1 | tail 40000]

https://docs.splunk.com/Documentation/Splunk/8.0.1/SearchReference/Union

0 Karma

UMDTERPS
Communicator

Okay, figured it out:

|inputlookup ip_dump.csv 
| streamstats count("IP Address") as row_number
| where row_number <= 50000
| append [
    |inputlookup ip_dump.csv 
    | streamstats count("IP Address") as row_number
    | where row_number > 50000]
0 Karma

somesoni2
Revered Legend

Give this workaroud a try (single search with no subsearch)

| inputlookup yourlookup.csv 
| streamstats count as fwd_sno
| reverse 
| streamstats count as rev_sno
| reverse
| where fwd_sno<=35000 OR rev_sno<=35000

Basically adding two serial number columns, one in up to down and second down to up. Then selecting first 35000 rows in either serial number.

0 Karma

UMDTERPS
Communicator

I think this would work too! =0)

Thanks!

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...