<?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: Extract and download a field of array from an event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-download-a-field-of-array-from-an-event/m-p/602895#M209837</link>
    <description>&lt;P&gt;Hi, you could use something like spath to process the json and then pick the logs array out of the resultant object.&amp;nbsp; Maybe something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;|makeresults&lt;BR /&gt;| eval json="{\"name\":\"json_name\", \"logs\":[{\"name\":\"log1\"}, { \"name\":\"log2\"}]}",&lt;BR /&gt;output_log_array=spath(json,"logs{}"),&lt;BR /&gt;output_log_names=spath(json,"logs{}.name")&lt;/PRE&gt;&lt;P&gt;I added a second example with output_log_names to show how you would extract particular fields within the array json into their own multivalued field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rymundo_splunk_0-1655944499206.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20240i13201D2C98F586B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rymundo_splunk_0-1655944499206.png" alt="rymundo_splunk_0-1655944499206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 23 Jun 2022 00:38:08 GMT</pubDate>
    <dc:creator>rymundo_splunk</dc:creator>
    <dc:date>2022-06-23T00:38:08Z</dc:date>
    <item>
      <title>How to extract and download a field of array from an event?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-download-a-field-of-array-from-an-event/m-p/602879#M209835</link>
      <description>&lt;P&gt;I have an event which is constructed like the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;{
   name: string,
   time: string,
   duration: string,
   logs: JSONObjects[]
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When I download the event, I just want the logs which is everything inside [] but without the head part which is "{logs:" and the last "}"&lt;/P&gt;
&lt;P&gt;To do that how do I construct the search query?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 19:02:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-download-a-field-of-array-from-an-event/m-p/602879#M209835</guid>
      <dc:creator>hantaliu</dc:creator>
      <dc:date>2022-06-23T19:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: Extract and download a field of array from an event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-download-a-field-of-array-from-an-event/m-p/602895#M209837</link>
      <description>&lt;P&gt;Hi, you could use something like spath to process the json and then pick the logs array out of the resultant object.&amp;nbsp; Maybe something like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;|makeresults&lt;BR /&gt;| eval json="{\"name\":\"json_name\", \"logs\":[{\"name\":\"log1\"}, { \"name\":\"log2\"}]}",&lt;BR /&gt;output_log_array=spath(json,"logs{}"),&lt;BR /&gt;output_log_names=spath(json,"logs{}.name")&lt;/PRE&gt;&lt;P&gt;I added a second example with output_log_names to show how you would extract particular fields within the array json into their own multivalued field.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rymundo_splunk_0-1655944499206.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/20240i13201D2C98F586B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rymundo_splunk_0-1655944499206.png" alt="rymundo_splunk_0-1655944499206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jun 2022 00:38:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-and-download-a-field-of-array-from-an-event/m-p/602895#M209837</guid>
      <dc:creator>rymundo_splunk</dc:creator>
      <dc:date>2022-06-23T00:38:08Z</dc:date>
    </item>
  </channel>
</rss>

