Splunk Search

Finding original URL where the request came from when http_referrer is not available

neerajs_81
Builder

Hello, When analyzing web traffic logs, at times the url field does not have a http_referrer field.  We are interested in finding out which URL did the original request came from ?  There is looping involved.
 THis is similar to the post:  https://community.splunk.com/t5/Getting-Data-In/Loop-through-URL-and-http-referrer-to-find-original-...

In the above post, user makes use of a script which I cannot use in my environment.  How to then use the MAP command or any other command to recursively/loop thru the URL field and find out which was the original domain ?

For example:
index=firewall url =malicious-domain.com
Actual flow of traffic:
abc.com  >>> bcd.com  >>  No Http_Referrer field  >> malicious-domain.com  ( http_referrer is <empty>) 

Expected result:
abc.com

Labels (4)
0 Karma
1 Solution

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

Only filtering URL should be enough. I could only test with your sample data. You may need to adjust according to indexed data.

 

index="firewall" sourcetype="proxy" URL="malicious-domain.com"
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.

View solution in original post

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

Only filtering URL should be enough. I could only test with your sample data. You may need to adjust according to indexed data.

 

index="firewall" sourcetype="proxy" URL="malicious-domain.com"
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.

neerajs_81
Builder

Thank you.  I am getting close  but not there yet.  In my case, the original URL shows many different URLs . There is not one specific originalURL in the results.  There is no way microsoft.com would be responsible for triggering that malicious domain.  Anyways,Appreciate your quick response.

My Results:

finalURLoriginalURL
malicious.comoutlook.office365.com
malicious.commicrosoft.com
malicious.comapp.growme.com:443
malicious.comxxxxxx
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @neerajs_81,

I just replied on your previous question in the previous post.

Please try below;

index="firewall" sourcetype="proxy" 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="firewall" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL
If this reply helps you an upvote and "Accept as Solution" is appreciated.
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Rounding off the Splunk Dashboard Contest

What does a contest-winning Splunk dashboard look like? In this case, it isn't in a browser tab at all. It ...

A Four Part Event Series: AI + Observability: AI Agents, LLMs, Apps, & Infrastructure

AI &#43; Observability: AI Agents, LLMs, Apps, & Infrastructure The rapid evolution of artificial intelligence ...