Splunk Search

Query to search for huge set of URLs

rbathla
New Member

I have close to 2000 URLs I want to search in one source. Is it possible to do it in one query by using lookup and what is the query?

Tags (1)
0 Karma
1 Solution

somesoni2
Revered Legend

You need to add those URLs in a csv file, say filterurl.csv with header as url, and add filterurl.csv as lookup table file in Splunk. Now try this,

if your data from that source has a field called url (same name as in lookup table) based on which you want to filter:

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url ]

if your data from that source has a field called myurl (different name as in lookup table) based on which you want to filter:

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url | rename url as myurl]

if your data doesn't have the field extracted and you want to do text based filter

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url | rename url as search]

View solution in original post

0 Karma

DalJeanis
Legend

Somesoni2's answer is correct to what is technically possible.

The caution required is that, if you have a set of 2000 URLs that you are going to be searching for, though your entire source, then unless that is an indexed field, that search is likely to take slightly less than forever. Be sure to test with a lookup table of, say, 50 URLs across a limited time period where you know at least a few events should be, before submitting a search that might suck enough power to dim the lights.

0 Karma

somesoni2
Revered Legend

You need to add those URLs in a csv file, say filterurl.csv with header as url, and add filterurl.csv as lookup table file in Splunk. Now try this,

if your data from that source has a field called url (same name as in lookup table) based on which you want to filter:

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url ]

if your data from that source has a field called myurl (different name as in lookup table) based on which you want to filter:

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url | rename url as myurl]

if your data doesn't have the field extracted and you want to do text based filter

index=yourindex sourcetype=yoursourcetype source=yoursource [| inputlookup filterurl.csv | table url | rename url as search]
0 Karma

rbathla
New Member

This was awesome. It worked. I am doing it in chunk of 500 and it is working.
Really appreciate the help always provided on the forum.

0 Karma

Richfez
SplunkTrust
SplunkTrust

Since that worked, could you please Accept somesoni2's answer? That will help future searchers find this easier and better!

0 Karma
Get Updates on the Splunk Community!

Updated Team Landing Page in Splunk Observability

We’re making some changes to the team landing page in Splunk Observability, based on your feedback. The ...

New! Splunk Observability Search Enhancements for Splunk APM Services/Traces and ...

Regardless of where you are in Splunk Observability, you can search for relevant APM targets including service ...

Webinar Recap | Revolutionizing IT Operations: The Transformative Power of AI and ML ...

The Transformative Power of AI and ML in Enhancing Observability   In the realm of IT operations, the ...