<?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: Structured fields and values in json api results in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104019#M21892</link>
    <description>&lt;P&gt;"search results will reflect this information and so will results retrieved via the api."&lt;/P&gt;

&lt;P&gt;My search results seem to be keyed fine - e.g. if I pipe a search to "table *" or search for "color=red", the right things happen. Splunk is clearly treating my data as properly separated-out rows/cols/cells.&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2011 20:50:23 GMT</pubDate>
    <dc:creator>stevesq</dc:creator>
    <dc:date>2011-05-18T20:50:23Z</dc:date>
    <item>
      <title>Structured fields and values in json api results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104017#M21890</link>
      <description>&lt;P&gt;In your REST API documentation you have the following json example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    // sample JSON output
// &lt;A href="https://localhost:8089/services/search/jobs/1234/results?output_mode=json" target="test_blank"&gt;https://localhost:8089/services/search/jobs/1234/results?output_mode=json&lt;/A&gt;

[
{
"_cd": "0:4374557",
"_index": "main",
"_kv": "1",
"_meta": " date_second::36 date_hour::19 date_minute::11 date_year::2008 date_month::january date_mday::21 date_wday::monday date_zone::-480 punct::_[//:::_-]____\\\"@...\\\"...",
"_raw": "I [21/Jan/2008:19:11:36 -0800] Added remote printer \"HPLaserJ@10.1.1.123\"...",
"_serial": "0",
"_time": "1200971496",
"date_hour": "19",
"date_mday": "21",
"date_minute": "11",
"date_month": "january",
"date_second": "36",
"date_wday": "monday",
"date_year": "2008",
"date_zone": "-480",
"host": "decider.local",
"linecount": "1",
"punct": "_[//:::_-]____\"@...\"...",
"source": "/var/log/cups/error_log",
"sourcetype": "cups_error"
},
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However when I make an api request and then check results from the /results endpoint, I only see the raw data and a few other fields, like so:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
"_cd": "6:719660",
"_indextime": "1305696946",
"_raw": "id=\"123\" color=\"red\" foo= model=\"accord\"",
"_serial": "93",
"_si": "log.example.com\nmain",
"_sourcetype": "car_sourcetype",
"_time": "2010-07-18T19:19:30.000+00:00",
"host": "log.example.com",
"index": "main",
"linecount": "1",
"source": "cars",
"sourcetype": "cars_sourcetype",
"splunk_server": "log.example.com"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;},&lt;/P&gt;

&lt;P&gt;Note that _kv is missing, as well as the broken-out keys and values. What triggers these to be put in the api results? I can't find anything obvious in the api docs.&lt;/P&gt;

&lt;P&gt;-Steve&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2011 05:52:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104017#M21890</guid>
      <dc:creator>stevesq</dc:creator>
      <dc:date>2011-05-18T05:52:09Z</dc:date>
    </item>
    <item>
      <title>Re: Structured fields and values in json api results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104018#M21891</link>
      <description>&lt;P&gt;stevesq,&lt;/P&gt;

&lt;P&gt;I suspect key-value pair extracting is not occurring for your sourcetype.  Key-value extraction is configured via props.conf/transforms.conf.  Once key-value pair extractions are specified for your data, search results will reflect this information and so will results retrieved via the api.&lt;/P&gt;

&lt;P&gt;What's interesting is that Splunk is not automatically extracting &lt;CODE&gt;key=value&lt;/CODE&gt; pairs in your &lt;CODE&gt;_raw&lt;/CODE&gt; message.  Perhaps &lt;CODE&gt;KV_MODE&lt;/CODE&gt; is set to &lt;CODE&gt;None&lt;/CODE&gt; or "Field discovery" was disabled (if search was executed from the UI).&lt;/P&gt;

&lt;P&gt;Can you verify flashtimeline searches return the expected "id/color/foo/model" fields?&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2011 19:02:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104018#M21891</guid>
      <dc:creator>hazekamp</dc:creator>
      <dc:date>2011-05-18T19:02:31Z</dc:date>
    </item>
    <item>
      <title>Re: Structured fields and values in json api results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104019#M21892</link>
      <description>&lt;P&gt;"search results will reflect this information and so will results retrieved via the api."&lt;/P&gt;

&lt;P&gt;My search results seem to be keyed fine - e.g. if I pipe a search to "table *" or search for "color=red", the right things happen. Splunk is clearly treating my data as properly separated-out rows/cols/cells.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2011 20:50:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104019#M21892</guid>
      <dc:creator>stevesq</dc:creator>
      <dc:date>2011-05-18T20:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: Structured fields and values in json api results</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104020#M21893</link>
      <description>&lt;P&gt;I made it work by including &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;required_field_list=*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;in the search POST:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;curl -u admin:foobar -k &lt;A href="https://localhost:8089/services/search/jobs" target="test_blank"&gt;https://localhost:8089/services/search/jobs&lt;/A&gt; -d"search=search source=cars | head 1 &amp;amp;required_field_list=*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Could be a bug. &lt;/P&gt;</description>
      <pubDate>Sat, 21 May 2011 14:41:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Structured-fields-and-values-in-json-api-results/m-p/104020#M21893</guid>
      <dc:creator>stevesq</dc:creator>
      <dc:date>2011-05-21T14:41:46Z</dc:date>
    </item>
  </channel>
</rss>

