<?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: JSON extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681834#M232987</link>
    <description>&lt;LI-CODE lang="markup"&gt;| spath {}.orderTypesTotal{} output=orderTypesTotal
| mvexpand orderTypesTotal
| spath input=orderTypesTotal
| stats sum(totalFailedTransactions) as totalFailedTransaction sum(totalSuccessfulTransactions) as totalSuccessfulTransactions sum(totalTransactions) as totalTransactions by orderType&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 25 Mar 2024 09:58:39 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2024-03-25T09:58:39Z</dc:date>
    <item>
      <title>JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681832#M232986</link>
      <description>&lt;P&gt;Hello Expert Splunk Community ,&lt;/P&gt;&lt;P&gt;I am struggling with a JSON extraction .&lt;BR /&gt;Need help/advice on how to do this operation&lt;BR /&gt;&lt;BR /&gt;Data Sample :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
{
"orderTypesTotal": [
{
"orderType": "Purchase",
"totalFailedTransactions": 0,
"totalSuccessfulTransactions": 0,
"totalTransactions": 0
},
{
"orderType": "Sell",
"totalFailedTransactions": 0,
"totalSuccessfulTransactions": 0,
"totalTransactions": 0
},
{
"orderType": "Cancel",
"totalFailedTransactions": 0,
"totalSuccessfulTransactions": 1,
"totalTransactions": 1
}
],
"totalTransactions": [
{
"totalFailedTransactions": 0,
"totalSuccessfulTransactions": 1,
"totalTransactions": 1
}
]
}
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[
{
"orderTypesTotal": [
{
"orderType": "Purchase",
"totalFailedTransactions": 10,
"totalSuccessfulTransactions": 2,
"totalTransactions": 12
},
{
"orderType": "Sell",
"totalFailedTransactions": 1,
"totalSuccessfulTransactions": 2,
"totalTransactions": 3
},
{
"orderType": "Cancel",
"totalFailedTransactions": 0,
"totalSuccessfulTransactions": 1,
"totalTransactions": 1
}
],
"totalTransactions": [
{
"totalFailedTransactions": 11,
"totalSuccessfulTransactions": 5,
"totalTransactions": 16
}
]
}
]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the above event coming inside a field in _raw events . using json(field) i have validated that the above is a valid json .&lt;/P&gt;&lt;P&gt;UseCase :&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need to have the total of all the different ordertypes using totalFailedTransactions": ,&lt;BR /&gt;"totalSuccessfulTransactions": ,&lt;BR /&gt;"totalTransactions": numbers into a table .&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="12.5%" height="26px"&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD width="12.5%" height="26px"&gt;totalFailedTransactions&lt;/TD&gt;&lt;TD width="25%" height="26px"&gt;totalSuccessfulTransactions&lt;/TD&gt;&lt;TD width="50%" height="26px"&gt;totalTransactions&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.5%" height="25px"&gt;Purchase&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;10&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;12&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;Sell&lt;/TD&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;3&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="12.5%" height="25px"&gt;Cancel&lt;/TD&gt;&lt;TD width="12.5%" height="25px"&gt;0&lt;/TD&gt;&lt;TD width="25%" height="25px"&gt;2&lt;/TD&gt;&lt;TD width="50%" height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;BR /&gt;Sam&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 09:56:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681832#M232986</guid>
      <dc:creator>psamuel69</dc:creator>
      <dc:date>2024-03-25T09:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681834#M232987</link>
      <description>&lt;LI-CODE lang="markup"&gt;| spath {}.orderTypesTotal{} output=orderTypesTotal
| mvexpand orderTypesTotal
| spath input=orderTypesTotal
| stats sum(totalFailedTransactions) as totalFailedTransaction sum(totalSuccessfulTransactions) as totalSuccessfulTransactions sum(totalTransactions) as totalTransactions by orderType&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Mar 2024 09:58:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681834#M232987</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-25T09:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681847#M232989</link>
      <description>&lt;P&gt;Thanks for your quick response .&lt;BR /&gt;&lt;BR /&gt;I tried using spath aswell .&lt;BR /&gt;But it seems that the field is not getting extracted in between , as the error suggests ..&lt;/P&gt;&lt;LI-SPOILER&gt;Field 'orderTypesTotal' does not exist in the data.&lt;/LI-SPOILER&gt;&lt;P&gt;Do you think an extracted json would have an issue where as a raw json would work with spath ?&lt;BR /&gt;&lt;BR /&gt;As my json payload is created only after adding extraction via a regex on a raw event .&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 11:34:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681847#M232989</guid>
      <dc:creator>psamuel69</dc:creator>
      <dc:date>2024-03-25T11:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681848#M232990</link>
      <description>&lt;P&gt;That is difficult to determine since you haven't shared your raw event nor how you have extracted the JSON part.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 11:40:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681848#M232990</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-25T11:40:37Z</dc:date>
    </item>
    <item>
      <title>Re: JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681852#M232991</link>
      <description>&lt;P&gt;eval'ed my extracted payload to _raw and voila , it works !!!&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your time and expertise !&lt;/P&gt;</description>
      <pubDate>Mon, 25 Mar 2024 12:28:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681852#M232991</guid>
      <dc:creator>psamuel69</dc:creator>
      <dc:date>2024-03-25T12:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: JSON extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681855#M232992</link>
      <description>&lt;P&gt;If your JSON was already in a field, you could have used the input parameter to spath (this defaults to _raw)&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=&amp;lt;your field&amp;gt; ...&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 25 Mar 2024 12:54:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-extraction/m-p/681855#M232992</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-03-25T12:54:28Z</dc:date>
    </item>
  </channel>
</rss>

