<?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: Field Extraction for REST API Logs in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20344#M3158</link>
    <description>&lt;P&gt;let me try...&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2011 15:32:10 GMT</pubDate>
    <dc:creator>lpolo</dc:creator>
    <dc:date>2011-11-22T15:32:10Z</dc:date>
    <item>
      <title>Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20338#M3152</link>
      <description>&lt;P&gt;The content of the log is basically API REST calls. I am facing the issue of not being able to extract the fields of the API calls correctly because the order of some fields changes. &lt;BR /&gt;
This is an example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2011-11-21 15:03:59,926 &amp;lt;query id=d2f98492-94c3-48dc-bb06-525de5ca60c9&amp;gt;/abc/find?house.types=condo,apt,townhome,house&amp;amp;avail.zip.area=area-whitelist&amp;amp;results.limit=7&amp;amp;avail.db1.location=20008|X&amp;amp;results.start=1&amp;amp;q=homes&amp;amp;user.account=1&amp;amp;avail.db.device=ipad&amp;amp;avail.resources=mris,lf&amp;amp;fields=usa,ca$id,wfi,lf$id,best.worst,time.endYear,releaseYear&amp;lt;/query&amp;gt;    

2011-11-21 15:03:29,995 &amp;lt;query id=d2f98492-94c3-48dc-bb06-525de5ca60A9&amp;gt;/abc/find?house.types=condo,apt,townhome,house&amp;amp;results.limit=7&amp;amp;avail.db1.location=20008|X&amp;amp;results.start=1&amp;amp;q=homes&amp;amp;user.account=1&amp;amp;avail.db.device=ipad&amp;amp;avail.resources=mris,lf&amp;amp;fields=usa,ca$id,wfi,lf$id,best.worst,time.endYear,releaseYear&amp;amp;avail.zip.area=area-whitelist&amp;lt;/query&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In this case field "avail.zip.area" moved its position. Any field can move to any valid position.&lt;/P&gt;

&lt;P&gt;How can I address this issue?&lt;/P&gt;

&lt;P&gt;Thanks, &lt;BR /&gt;
Lp&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2011 19:06:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20338#M3152</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2011-11-21T19:06:12Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20339#M3153</link>
      <description>&lt;P&gt;You can address this issue by adding EXTRACT statements in your props under the appropriate stanza which describes the data from this source.&lt;BR /&gt;
Let's assume this data's sourcetype is &lt;CODE&gt;mytype&lt;/CODE&gt;. Unless you have props.conf elsewhere, create one in &lt;CODE&gt;$SPLUNK_HOME/etc/system/local&lt;/CODE&gt; and add the following:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[mytype]&lt;BR /&gt;
..&lt;BR /&gt;
EXTRACT-zip = avail.zip.area=(?&amp;lt;avail_zip_area&amp;gt;.*?)[\&amp;amp;|\&amp;lt;]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will create a search-time extraction that will create a field called avail_zip_area and pick-up the right value as long as it is followed by a &lt;CODE&gt;"&amp;amp;"&lt;/CODE&gt; or &lt;CODE&gt;"&amp;lt;"&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Hope this helps.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&amp;gt; please upvote and accept answer if you find it useful - thanks!&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:08:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20339#M3153</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2020-09-28T10:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20340#M3154</link>
      <description>&lt;P&gt;It works if you run it via "rex" search command. If you configure it in $SPLUNK_HOME/etc/system/local/props.conf it does not work. I have never been able to configure REST API logs in Splunk.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 14:09:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20340#M3154</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2011-11-22T14:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20341#M3155</link>
      <description>&lt;P&gt;Did you try a &lt;CODE&gt;| extract reload=t&lt;/CODE&gt; in your search? What does your props.conf stanza for this extraction look like?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 14:18:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20341#M3155</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-11-22T14:18:50Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20342#M3156</link>
      <description>&lt;P&gt;I did try |extract reload=t. It did not work. The props.conf is basically what you recommended. I think that the problem is that Splunk is dealing with the "." character and it conflicts with my props.conf.&lt;BR /&gt;
If I remove props.conf Splunk tries to extract the fields but with some inconsistencies. When I use "rex" command to test my regular expression works fine.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:26:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20342#M3156</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2011-11-22T15:26:55Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20343#M3157</link>
      <description>&lt;P&gt;Your props seem to be wrong. Well, first the stanza header needs to reflect the sourcetype of the data - if your sourcetype is &lt;CODE&gt;rex-srch-qen-solr-rest_request&lt;/CODE&gt; then you are OK. Next, you have to rework your extractions:&lt;/P&gt;

&lt;P&gt;This won't work:&lt;BR /&gt;
&lt;CODE&gt;[rex-srch-qen-solr-rest_request] &lt;BR /&gt;
...&lt;BR /&gt;
EXTRACT-results.start=(?&amp;lt;results_start&amp;gt;.*?)[\&amp;amp;|\&amp;lt;|\?]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;This will:&lt;BR /&gt;
&lt;CODE&gt;[rex-srch-qen-solr-rest_request] &lt;BR /&gt;
...&lt;BR /&gt;
EXTRACT-results.start = results\.start\=(?&amp;lt;results_start&amp;gt;.*?)[\&amp;amp;|\&amp;lt;|\?]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You need to include &lt;CODE&gt;results\.start\=&lt;/CODE&gt; in your extraction so that you tell splunk where exactly to start looking for that field.&lt;/P&gt;

&lt;P&gt;Likewise for this other extraction: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;[rex-srch-qen-solr-rest_request] &lt;BR /&gt;
...&lt;BR /&gt;
EXTRACT-avail.zip.area = avail\.zip\.area\=(?&amp;lt;avail_zip_area&amp;gt;.*?)[\&amp;amp;|\&amp;lt;|\?]&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope it helps.&lt;/P&gt;

&lt;P&gt;EDIT: Escaped the dots and equal signs just to be safe&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:27:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20343#M3157</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-11-22T15:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20344#M3158</link>
      <description>&lt;P&gt;let me try...&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 15:32:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20344#M3158</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2011-11-22T15:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20345#M3159</link>
      <description>&lt;P&gt;&lt;EM&gt;D&lt;/EM&gt;,&lt;/P&gt;

&lt;P&gt;It partially worked. I escaped the dots and equal signs but Splunk refuses to report consistently. For example:&lt;BR /&gt;
In the logs:&lt;BR /&gt;
available_zip_area=20016,20008.&lt;/P&gt;

&lt;P&gt;Splunk just reports the first zip:&lt;BR /&gt;
Just reports: available_zip_area=20016.&lt;/P&gt;

&lt;P&gt;If I use the regular expression with "rex" command I can get all the zips:&lt;BR /&gt;
available_zip_area=20016,20008.&lt;/P&gt;

&lt;P&gt;Any idea?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:08:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20345#M3159</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2020-09-28T10:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20346#M3160</link>
      <description>&lt;P&gt;Are you saying that you used &lt;CODE&gt;avail\.zip\.area\=(?&amp;lt;avail_zip_area&amp;gt;.*?)[\&amp;amp;|\&amp;lt;|\?]&lt;/CODE&gt; with &lt;CODE&gt;rex&lt;/CODE&gt; and &lt;CODE&gt;props.conf&lt;/CODE&gt; and got different results?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2011 16:39:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20346#M3160</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2011-11-22T16:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Field Extraction for REST API Logs</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20347#M3161</link>
      <description>&lt;P&gt;Yes. props.conf does not report any other string after the ",". This is an example:&lt;/P&gt;

&lt;P&gt;index=main sourcetype="rex-srch-qen-solr-rest_request" | top  limit=3 available_zip_area&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;available_zip_area  count   percent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   20016   81691   90.898065&lt;BR /&gt;
2   20008   8077    8.987326&lt;BR /&gt;
3   20045   91  0.101256&lt;/P&gt;

&lt;P&gt;Now with rex: &lt;BR /&gt;
index=main sourcetype="rex-srch-qen-solr-rest_request" | rex "available.zip.area=(?&lt;AVAILABLE_ZIP_AREA&gt;.*?)[&amp;amp;|&amp;lt;|?]" | top  limit=3 available_zip_area&lt;/AVAILABLE_ZIP_AREA&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;available_zip_area  count   percent
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;1   20016,20015 81691   90.898065&lt;BR /&gt;
2   20008,20815,20816   8077    8.987326&lt;BR /&gt;
3   20045,20016 91  0.101256&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 10:08:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Field-Extraction-for-REST-API-Logs/m-p/20347#M3161</guid>
      <dc:creator>lpolo</dc:creator>
      <dc:date>2020-09-28T10:08:31Z</dc:date>
    </item>
  </channel>
</rss>

