<?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: How to extract a field from a GET request? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361809#M106870</link>
    <description>&lt;P&gt;Yes just use the space in the rex too&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=_raw "(?&amp;lt;=POST|GET)\s(&amp;lt;?yourfield&amp;gt;\/[^\/|\s]*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 16 Mar 2018 21:56:50 GMT</pubDate>
    <dc:creator>tiagofbmm</dc:creator>
    <dc:date>2018-03-16T21:56:50Z</dc:date>
    <item>
      <title>How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361802#M106863</link>
      <description>&lt;P&gt;Hi All - I am having trouble extracting the following fields from a GET request . &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;GET **/TSGene/**images/literature.jpg
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I tried the following but it did not seem to work &lt;CODE&gt;\bGET\s+\K\S+(\/[\/[:word:]\-\.\=\&amp;amp;\?]+)\s&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I just want to extract the part highlighted above. Thanks in advance!&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Deepthi&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:44:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361802#M106863</guid>
      <dc:creator>dmenon84</dc:creator>
      <dc:date>2018-03-16T15:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361803#M106864</link>
      <description>&lt;P&gt;Can you please paste a full example of the GET request?&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 15:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361803#M106864</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-16T15:49:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361804#M106865</link>
      <description>&lt;P&gt;Sure - some more samples of GET and POST &lt;/P&gt;

&lt;P&gt;"HTTPS","","POST /TSGene/search_result.cgi HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","gene=5781","GET /TSGene/gene_general.cgi?gene=5781 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","GET /favicon.ico HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","POST /TSGene/search_result.cgi HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","ver=20142803","GET /static/wp-content/plugins/fruitful-shortcodes/includes/shortcodes/js/tabs/easyResponsiveTabs.js?ver=20142803 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","ver=1.11.4","GET /static/wp-includes/js/jquery/ui/slider.min.js?ver=1.11.4 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","GET /orl/wp-content/themes/utms-orl/images/common/prefooter-bg.jpg HTTP/1.1\r\n&lt;/P&gt;

&lt;P&gt;some logs have version number in between &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:33:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361804#M106865</guid>
      <dc:creator>dmenon84</dc:creator>
      <dc:date>2020-09-29T18:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361805#M106866</link>
      <description>&lt;P&gt;Try this.. Your fieldname will be &lt;CODE&gt;GET&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex (?&amp;lt;GET&amp;gt;GET\s\S+\.jpg)&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:14:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361805#M106866</guid>
      <dc:creator>skoelpin</dc:creator>
      <dc:date>2018-03-16T16:14:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361806#M106867</link>
      <description>&lt;P&gt;Sorry if I wasn't clear I only want the following parts extracted. The data between the first slashes / after GET which should include the slashes / . &lt;/P&gt;

&lt;P&gt;Extracted data - &lt;/P&gt;

&lt;P&gt;/TSGene/&lt;BR /&gt;
 /TSGene/&lt;BR /&gt;
 /favicon.ico&lt;BR /&gt;
 /TSGene/&lt;BR /&gt;
 /static/&lt;BR /&gt;
/static/&lt;BR /&gt;
/orl/&lt;/P&gt;

&lt;P&gt;Actual requests - &lt;/P&gt;

&lt;P&gt;"HTTPS","","POST /TSGene/search_result.cgi HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","gene=5781","GET /TSGene/gene_general.cgi?gene=5781 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","GET /favicon.ico HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","POST /TSGene/search_result.cgi HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","ver=20142803","GET /static/wp-content/plugins/fruitful-shortcodes/includes/shortcodes/js/tabs/easyResponsiveTabs.js?ver=20142803 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","ver=1.11.4","GET /static/wp-includes/js/jquery/ui/slider.min.js?ver=1.11.4 HTTP/1.1\r\n&lt;BR /&gt;
"HTTPS","","GET /orl/wp-content/themes/utms-orl/images/common/prefooter-bg.jpg HTTP/1.1\r\n&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 18:31:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361806#M106867</guid>
      <dc:creator>dmenon84</dc:creator>
      <dc:date>2020-09-29T18:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361807#M106868</link>
      <description>&lt;P&gt;Try this one:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=_raw "(?&amp;lt;=POST|GET)\s(&amp;lt;?yourfield&amp;gt;\/[^\/]*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Mar 2018 16:33:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361807#M106868</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-16T16:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361808#M106869</link>
      <description>&lt;P&gt;Thanks that works better but in some cases it picks up the HTTP that follows the requests. &lt;/P&gt;

&lt;P&gt;Can this be modified to extract like this ?&lt;/P&gt;

&lt;P&gt;"HTTPS","","GET /favicon.ico HTTP/1.1\r\n    -&amp;gt;   /favicon.ico  should only be extracted. &lt;/P&gt;

&lt;P&gt;At this time, it extracts the following -&amp;gt; - /favicon.ico HTTP&lt;/P&gt;

&lt;P&gt;Thanks in advance !&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 20:43:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361808#M106869</guid>
      <dc:creator>dmenon84</dc:creator>
      <dc:date>2018-03-16T20:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361809#M106870</link>
      <description>&lt;P&gt;Yes just use the space in the rex too&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; | rex field=_raw "(?&amp;lt;=POST|GET)\s(&amp;lt;?yourfield&amp;gt;\/[^\/|\s]*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 16 Mar 2018 21:56:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361809#M106870</guid>
      <dc:creator>tiagofbmm</dc:creator>
      <dc:date>2018-03-16T21:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field from a GET request?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361810#M106871</link>
      <description>&lt;P&gt;This should get you what you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex "\"GET (?P&amp;lt;url&amp;gt;\/.*?[\/ ])" | eval url=trim(url)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will match in the case of an additional / and in the case where there isn't a second /.  If there is no / then there will be a trailing space in the url so I added a trim to remove it.  A fancier regex could probably remove the need for the trim but this works.&lt;/P&gt;

&lt;P&gt;I'm a little confused about what you want to do with POSTs.  In your example above, you still parsed POSTs but maybe that was just an oversight.  I would suggest filtering them out so you are only processing events with ""GET " in the event.  If you don't filter them out then the "url" field will be NULL since the regex will not match. &lt;/P&gt;</description>
      <pubDate>Mon, 19 Mar 2018 04:04:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-from-a-GET-request/m-p/361810#M106871</guid>
      <dc:creator>FeatureCreeep</dc:creator>
      <dc:date>2018-03-19T04:04:39Z</dc:date>
    </item>
  </channel>
</rss>

