<?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 these fields from my sample data? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144072#M40085</link>
    <description>&lt;P&gt;See if this works (run anywhere sample based on your data)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="Time Taken: 937534 URL_STRING: /account/signin.jsp 95.104.163.4 - - [27/Jul/2015:02:10:34 -0700] \"GET /account/signin.jsp?PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374304776473&amp;amp;bmUID=kX4Nj97 HTTP/1.1\" 200 Bytes: 97413 \"http://www.xxx.com/shop/dept_category.jsp?productSizeSelected=0&amp;amp;pageClicked=0&amp;amp;PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374306291898&amp;amp;bmUID=kX4NaK4\" \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 YaBrowser/15.6.2311.5029 Safari/537.36\"" | table temp | rename temp as _raw | rex "Time Taken: (?&amp;lt;TimeTaken&amp;gt;\d+)([^\"]+)\"([^\"]+)\" (?&amp;lt;ResponseCode&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 27 Jul 2015 20:31:13 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2015-07-27T20:31:13Z</dc:date>
    <item>
      <title>How to extract these fields from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144070#M40083</link>
      <description>&lt;P&gt;I wanted to extract the below values.&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Time Taken&lt;/LI&gt;
&lt;LI&gt;Response code in the string - HTTP/1.1" 200 example, I need to know what the response code is, whether 200/404/500&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Sample data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; Time Taken: 937534 URL_STRING: /account/signin.jsp 95.104.163.4 - - [27/Jul/2015:02:10:34 -0700] "GET /account/signin.jsp?PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374304776473&amp;amp;bmUID=kX4Nj97 HTTP/1.1" 200 Bytes: 97413 "http://www.xxx.com/shop/dept_category.jsp?productSizeSelected=0&amp;amp;pageClicked=0&amp;amp;PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374306291898&amp;amp;bmUID=kX4NaK4" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 YaBrowser/15.6.2311.5029 Safari/537.36"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Jul 2015 11:35:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144070#M40083</guid>
      <dc:creator>mcvr</dc:creator>
      <dc:date>2015-07-27T11:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract these fields from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144071#M40084</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;timetaken------- &lt;CODE&gt;rex "Time Taken:(?\d*)"&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;status---------- &lt;CODE&gt;rex "HTTP/\d.\d\"(?\d*)"&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;you can try with erex command and can get the proper regular expression from job or you can use the knowlede object "field extraction" so that you can get the base regular expression.&lt;/P&gt;

&lt;P&gt;Above regular expression required little bit tweaking and testing.&lt;/P&gt;

&lt;P&gt;-Krishan Rajapantula.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jul 2015 13:23:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144071#M40084</guid>
      <dc:creator>krishnarajapant</dc:creator>
      <dc:date>2015-07-27T13:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract these fields from my sample data?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144072#M40085</link>
      <description>&lt;P&gt;See if this works (run anywhere sample based on your data)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| gentimes start=-1 | eval temp="Time Taken: 937534 URL_STRING: /account/signin.jsp 95.104.163.4 - - [27/Jul/2015:02:10:34 -0700] \"GET /account/signin.jsp?PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374304776473&amp;amp;bmUID=kX4Nj97 HTTP/1.1\" 200 Bytes: 97413 \"http://www.xxx.com/shop/dept_category.jsp?productSizeSelected=0&amp;amp;pageClicked=0&amp;amp;PRODUCT%3C%3Eprd_id=845524446072891&amp;amp;FOLDER%3C%3Efolder_id=2534374306291898&amp;amp;bmUID=kX4NaK4\" \"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.152 YaBrowser/15.6.2311.5029 Safari/537.36\"" | table temp | rename temp as _raw | rex "Time Taken: (?&amp;lt;TimeTaken&amp;gt;\d+)([^\"]+)\"([^\"]+)\" (?&amp;lt;ResponseCode&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 27 Jul 2015 20:31:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-these-fields-from-my-sample-data/m-p/144072#M40085</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2015-07-27T20:31:13Z</dc:date>
    </item>
  </channel>
</rss>

