<?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 split the JSON array into multiple new events? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612322#M212896</link>
    <description>&lt;P&gt;Heyyy!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Thank you so much for the helpful reply!&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; It does separate data into different rows. However, when I bring data from other service/actions,&amp;nbsp; data is not combined in a expected way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since it is my second week using Splunk, please excuse my native &amp;amp; obvious questions.&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below are some detailed explanations &amp;amp; screenshots.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;results&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;(where accountAction actionAvailable actionNotAvailableReason are from)&amp;nbsp;&lt;/STRONG&gt;is from&amp;nbsp; action=getAccountAvailableActions&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;specialtyProduct&lt;/STRONG&gt; is from action=getServiceabilityByAddressId_V3&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customerType&lt;/STRONG&gt; is from&amp;nbsp;"isRepeatTroubleCallEligible"&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the query I used to test. As you can see, either data source will be "null",&amp;nbsp; and when I search for both of them are not "null", it returns no result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21367i5FA5728FA784962E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I tried to aggregate data a little bit to ensure there are data showing up, it just goes back to the stacked result&lt;span class="lia-unicode-emoji" title=":crying_face:"&gt;😢&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21368i212C7C373B1200FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the final query I have came up with. What I eventually want to achieve is a result that I can filter on by playing with customerType, accountAction, smb_ind and actionAvailable to do some negative tests to monitor if the backend logics for different accountActions (such as Multi-AP Salable) are running correct or not. Due to the multiple returned values from JSON array, statistics table is not showing the correct result at this moment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for the highlighted transaction_id, actionAvailable returns "Y" in the table, but when I dive into&amp;nbsp; event. it actually is N when accountAction is Multi-AP Salable. Please see the screenshot I attached in the message.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="9.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21370iDFD2DF783978C18B/image-size/large?v=v2&amp;amp;px=999" role="button" title="9.PNG" alt="9.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="8.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21371iB990DAD19C7693C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="8.PNG" alt="8.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="10.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21372i8CA4128A49BA7D90/image-size/large?v=v2&amp;amp;px=999" role="button" title="10.PNG" alt="10.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for the responsive reply. Looking forward to hearing insights from you very soon!&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
    <pubDate>Wed, 07 Sep 2022 21:19:48 GMT</pubDate>
    <dc:creator>jhcbazinga95</dc:creator>
    <dc:date>2022-09-07T21:19:48Z</dc:date>
    <item>
      <title>How to split the JSON array into multiple new events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612162#M212829</link>
      <description>&lt;P&gt;Hey all,&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can someone help me out with a JSON related question! Many many thanks! &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I have a JSON arrays field in this format&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;results=&amp;lt;200 OK OK,&lt;BR /&gt;{&lt;BR /&gt;"tnPortingActivityInProgress" : "N",&lt;BR /&gt;"availableActions" :&lt;BR /&gt;[&lt;BR /&gt;{&lt;BR /&gt;"accountAction" : "Restart",&lt;BR /&gt;"actionAvailable" : "N",&lt;BR /&gt;"actionNotAvailableReason" : "Account is Active"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"accountAction" : "Multi-AP Salable",&lt;BR /&gt;"actionAvailable" : "Y"&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"accountAction" : "Seasonal Suspend",&lt;BR /&gt;"actionAvailable" : "Y"&lt;BR /&gt;}&lt;BR /&gt;],&lt;BR /&gt;"transactionId" : "1234567"&lt;BR /&gt;}&lt;BR /&gt;,[]&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I would love to parse the json array into this format.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;TABLE border="1" width="76.5625%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;transactionId &lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;aaccountAction&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="12.5%" height="25px"&gt;&lt;SPAN&gt;actionAvailable&amp;nbsp;&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;actionNotAvailableReason&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;1234567&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;Restart&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="12.5%" height="25px"&gt;N&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;Account is Active&lt;/SPAN&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;1234567&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&lt;SPAN&gt;Multi-AP Salable&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="12.5%" height="25px"&gt;Y&lt;/TD&gt;
&lt;TD width="25%" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="25%" height="62px"&gt;&lt;SPAN&gt;1234567&lt;/SPAN&gt;&lt;/TD&gt;
&lt;TD width="25%" height="62px"&gt;
&lt;P&gt;&lt;SPAN&gt;Seasonal Suspend&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD width="12.5%" height="62px"&gt;Y&lt;/TD&gt;
&lt;TD width="25%" height="62px"&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;I have tried a query like this. As you can see, the data is stacked in the same row right now, which is not working in my case&amp;nbsp; as I have no idea what actionAvailable &amp;amp; actionNotAvailableReason for what accountActions.&amp;nbsp; And also, the search is not working either if we do like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="1.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21346iB5BD267E4F002405/image-size/large?v=v2&amp;amp;px=999" role="button" title="1.PNG" alt="1.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Sep 2022 20:51:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612162#M212829</guid>
      <dc:creator>jhcbazinga95</dc:creator>
      <dc:date>2022-09-06T20:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to split the JSON array into multiple new events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612171#M212832</link>
      <description>&lt;LI-CODE lang="markup"&gt;| eval json=replace(replace(results,"&amp;lt;200 OK OK,",""),",{}&amp;gt;","")
| spath input=json availableActions{} output=availableActions
| mvexpand availableActions
| spath input=availableActions&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 06 Sep 2022 22:40:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612171#M212832</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2022-09-06T22:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to split the JSON array into multiple new events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612322#M212896</link>
      <description>&lt;P&gt;Heyyy!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Thank you so much for the helpful reply!&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; It does separate data into different rows. However, when I bring data from other service/actions,&amp;nbsp; data is not combined in a expected way.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Since it is my second week using Splunk, please excuse my native &amp;amp; obvious questions.&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Below are some detailed explanations &amp;amp; screenshots.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;results&lt;/STRONG&gt;&amp;nbsp;&lt;STRONG&gt;(where accountAction actionAvailable actionNotAvailableReason are from)&amp;nbsp;&lt;/STRONG&gt;is from&amp;nbsp; action=getAccountAvailableActions&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;specialtyProduct&lt;/STRONG&gt; is from action=getServiceabilityByAddressId_V3&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;customerType&lt;/STRONG&gt; is from&amp;nbsp;"isRepeatTroubleCallEligible"&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the query I used to test. As you can see, either data source will be "null",&amp;nbsp; and when I search for both of them are not "null", it returns no result.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="2.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21367i5FA5728FA784962E/image-size/large?v=v2&amp;amp;px=999" role="button" title="2.PNG" alt="2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I tried to aggregate data a little bit to ensure there are data showing up, it just goes back to the stacked result&lt;span class="lia-unicode-emoji" title=":crying_face:"&gt;😢&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="3.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21368i212C7C373B1200FB/image-size/large?v=v2&amp;amp;px=999" role="button" title="3.PNG" alt="3.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the final query I have came up with. What I eventually want to achieve is a result that I can filter on by playing with customerType, accountAction, smb_ind and actionAvailable to do some negative tests to monitor if the backend logics for different accountActions (such as Multi-AP Salable) are running correct or not. Due to the multiple returned values from JSON array, statistics table is not showing the correct result at this moment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for the highlighted transaction_id, actionAvailable returns "Y" in the table, but when I dive into&amp;nbsp; event. it actually is N when accountAction is Multi-AP Salable. Please see the screenshot I attached in the message.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="9.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21370iDFD2DF783978C18B/image-size/large?v=v2&amp;amp;px=999" role="button" title="9.PNG" alt="9.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="8.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21371iB990DAD19C7693C2/image-size/large?v=v2&amp;amp;px=999" role="button" title="8.PNG" alt="8.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="10.PNG" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/21372i8CA4128A49BA7D90/image-size/large?v=v2&amp;amp;px=999" role="button" title="10.PNG" alt="10.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you again for the responsive reply. Looking forward to hearing insights from you very soon!&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Sep 2022 21:19:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612322#M212896</guid>
      <dc:creator>jhcbazinga95</dc:creator>
      <dc:date>2022-09-07T21:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to split the JSON array into multiple new events?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612345#M212901</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/249216"&gt;@jhcbazinga95&lt;/a&gt;&amp;nbsp;First off, it's much easier to get help if you post sample code in text.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;is just showing you how to extract fields. &amp;nbsp;You still need to do stats according to plan.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval json=replace(replace(results,"&amp;lt;200 OK OK,",""),",{}&amp;gt;","")
| spath input=json path=transactionId
| spath input=json path=availableActions{}
| mvexpand availableActions{}
| spath input=availableActions{}
| stats values(actionNotAvailableReason) as actionNotAvailableReason by transactionId accountAction actionAvailable&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Using your sample data, output is&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="84.875px" height="25px"&gt;transactionId&lt;/TD&gt;&lt;TD width="143.5625px" height="25px"&gt;accountAction&lt;/TD&gt;&lt;TD width="121.109375px" height="25px"&gt;actionAvailable&lt;/TD&gt;&lt;TD width="201.46875px" height="25px"&gt;actionNotAvailableReason&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="84.875px" height="25px"&gt;1234567&lt;/TD&gt;&lt;TD width="143.5625px" height="25px"&gt;Multi-AP Salable&lt;/TD&gt;&lt;TD width="121.109375px" height="25px"&gt;Y&lt;/TD&gt;&lt;TD width="201.46875px" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="84.875px" height="25px"&gt;1234567&lt;/TD&gt;&lt;TD width="143.5625px" height="25px"&gt;Restart&lt;/TD&gt;&lt;TD width="121.109375px" height="25px"&gt;N&lt;/TD&gt;&lt;TD width="201.46875px" height="25px"&gt;Account is Active&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="84.875px" height="25px"&gt;1234567&lt;/TD&gt;&lt;TD width="143.5625px" height="25px"&gt;Seasonal Suspend&lt;/TD&gt;&lt;TD width="121.109375px" height="25px"&gt;Y&lt;/TD&gt;&lt;TD width="201.46875px" height="25px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Thu, 08 Sep 2022 03:25:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-split-the-JSON-array-into-multiple-new-events/m-p/612345#M212901</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2022-09-08T03:25:23Z</dc:date>
    </item>
  </channel>
</rss>

