<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Loop through URL and http_referrer to find original request in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138818#M28508</link>
    <description>&lt;P&gt;How is the data indexed? Maybe you could use a last or first command instead of looping through each one...&lt;/P&gt;</description>
    <pubDate>Wed, 05 Feb 2014 20:24:43 GMT</pubDate>
    <dc:creator>technoe</dc:creator>
    <dc:date>2014-02-05T20:24:43Z</dc:date>
    <item>
      <title>Can I loop through URL and http_referrer to find original request?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138817#M28507</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;
&lt;P&gt;I'd like to see the flow from a given final URL, back to original URL the user typed.&lt;/P&gt;
&lt;P&gt;In my Web Proxy Logs, I see the following :&lt;BR /&gt;_time, src_ip, http_referrer, http_method, URL&lt;/P&gt;
&lt;P&gt;For example :&lt;BR /&gt;003, 1.1.1.1, htp://&lt;A href="http://www.bbb.com/ads.html" target="_blank" rel="noopener"&gt;www.bbb.com/ads.html&lt;/A&gt;, GET, htp://&lt;A href="http://www.ccc.com/ccc.html" target="_blank" rel="noopener"&gt;www.ccc.com/ccc.html&lt;/A&gt;&lt;BR /&gt;002, 1.1.1.1, htp://&lt;A href="http://www.aaa.com/" target="_blank" rel="noopener"&gt;www.aaa.com/&lt;/A&gt;, GET, htp://&lt;A href="http://www.bbb.com/ads.html" target="_blank" rel="noopener"&gt;www.bbb.com/ads.html&lt;/A&gt;&lt;BR /&gt;001, 1.1.1.1, -, GET, htp://&lt;A href="http://www.aaa.com/" target="_blank" rel="noopener"&gt;www.aaa.com/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;What I want to do is, given the final URL (ccc.com/ccc.html), be able to go back in time, through the pair (http_referrer, URL) and find all the URLs up to the original one (aaa.com) with http_referrer="-".&lt;/P&gt;
&lt;P&gt;Sometimes this flow can be spread among 10 different requests mixed in the middle of other web traffic, so this is hard to find by hand.&lt;/P&gt;
&lt;P&gt;Programmatically I would do this with one loop, but I cannot find any loops with Splunk.&lt;/P&gt;
&lt;P&gt;Can you help me ? Thanks.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 15:55:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138817#M28507</guid>
      <dc:creator>bababou</dc:creator>
      <dc:date>2023-01-17T15:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138818#M28508</link>
      <description>&lt;P&gt;How is the data indexed? Maybe you could use a last or first command instead of looping through each one...&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 20:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138818#M28508</guid>
      <dc:creator>technoe</dc:creator>
      <dc:date>2014-02-05T20:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138819#M28509</link>
      <description>&lt;P&gt;What really interests me is the whole path.&lt;BR /&gt;
In this example : aaa.com -&amp;gt; bbb.com/ads.html -&amp;gt; ccc.com/ccc.html&lt;BR /&gt;
And not only the first and last requests.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 20:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138819#M28509</guid>
      <dc:creator>bababou</dc:creator>
      <dc:date>2014-02-05T20:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138820#M28510</link>
      <description>&lt;P&gt;See Splunk's map command which is looping operator.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 20:36:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138820#M28510</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-02-05T20:36:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138821#M28511</link>
      <description>&lt;P&gt;When you say "interested" how do you want the data expressed?  As a single field containing the full path?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 20:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138821#M28511</guid>
      <dc:creator>jsie_splunk</dc:creator>
      <dc:date>2014-02-05T20:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138822#M28512</link>
      <description>&lt;P&gt;Some kind of "transaction" could also be fine, ideally a &lt;CODE&gt;table&lt;/CODE&gt; with _time and url.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Feb 2014 20:42:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138822#M28512</guid>
      <dc:creator>bababou</dc:creator>
      <dc:date>2014-02-05T20:42:12Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138823#M28513</link>
      <description>&lt;P&gt;I solved my problem with an external script :&lt;/P&gt;

&lt;HR /&gt;

&lt;PRE&gt;&lt;CODE&gt;import splunk.Intersplunk

results, dummyresults, settings = splunk.Intersplunk.getOrganizedResults()

keywords, options = splunk.Intersplunk.getKeywordsAndOptions()
httpref = options.get('url', '-')

newresults = []

for result in results:
    if httpref == '-':
        break
    if result.get('url') == httpref:
        newresults.append(result)
        httpref = result.get('http_referer')

splunk.Intersplunk.outputResults(newresults)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;HR /&gt;

&lt;P&gt;And I call it this way :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | referer url="htp://www.ccc.com/ccc.html" | table _time, http_referer, url
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2014 12:54:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/138823#M28513</guid>
      <dc:creator>bababou</dc:creator>
      <dc:date>2014-02-13T12:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/627333#M107698</link>
      <description>&lt;P&gt;Can someone pls assist how to use MAP command or how to search for the original request URL&amp;nbsp; without the external script that was marked as solution ?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 11:53:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/627333#M107698</guid>
      <dc:creator>neerajs_81</dc:creator>
      <dc:date>2023-01-17T11:53:45Z</dc:date>
    </item>
    <item>
      <title>Re: Loop through URL and http_referrer to find original request</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/627342#M107699</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/229059"&gt;@neerajs_81&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Please try below sample with map command;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="web_proxy" sourcetype="proxy" 
| map search="search index="web_proxy" sourcetype="proxy" http_referrer=$URL$ OR http_referrer="-" | eval finalURL=$URL$ " 
| map search="search index="web_proxy" sourcetype="proxy" http_referrer=$http_referrer$ | eval finalURL=$finalURL$ " 
| search http_referrer="-" 
| dedup _raw 
| rename URL as originalURL 
| table finalURL originalURL&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jan 2023 12:36:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-I-loop-through-URL-and-http-referrer-to-find-original/m-p/627342#M107699</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2023-01-17T12:36:53Z</dc:date>
    </item>
  </channel>
</rss>

