<?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 How to concatenate fields from JSON in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-fields-from-JSON/m-p/669444#M229605</link>
    <description>&lt;P&gt;I have an inputlookup table, in this lookup table there is a JSON array called "Evidence"&lt;/P&gt;&lt;P&gt;There is two field I would like to extract, one is "Rule" and the "Criticality". An example of Evidence array will look like this:&lt;/P&gt;&lt;P&gt;{"Evidence":[{"Rule":"Observed in the Wild Telemetry","Criticality":1},{"Rule":"Recent DDoS","Criticality":3}]}&lt;/P&gt;&lt;P&gt;So if I eval both "Rule" and Criticality" as shown below:&lt;/P&gt;&lt;P&gt;| eval "Rule"=spath(Evidence, "Evidence{}.Rule")&lt;BR /&gt;| eval "Criticality"=spath(Evidence, "Evidence{}.Criticality")&lt;BR /&gt;| table Rule Criticality&lt;BR /&gt;&lt;BR /&gt;The output will show like this but the Rule &amp;amp; Criticality column doesn't separate into different row (it is all in one row):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;Rule&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;Criticality&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;Observed in the Wild Telemetry&lt;/DIV&gt;&lt;DIV class=""&gt;Recent DDoS&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;1&lt;/DIV&gt;&lt;DIV class=""&gt;3&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Now the tricky part, I would like display the top count of Rule (top Rule limit=10)&amp;nbsp; but at the same time display the associated Criticality with the Rule. How do it? since the above does not separate into different row.&lt;BR /&gt;&lt;BR /&gt;The final outlook I am looking for, will look like this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Rule&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Criticality&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Observed in the Wild Telemetry&lt;/TD&gt;&lt;TD height="25px"&gt;1&lt;/TD&gt;&lt;TD height="25px"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Recent DDoS&lt;/TD&gt;&lt;TD height="25px"&gt;3&lt;/TD&gt;&lt;TD height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;An alternative I was thinking was using foreach then concate it into a Combined Field, but I think It is kind of complex.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Nov 2023 11:26:53 GMT</pubDate>
    <dc:creator>BeeSpark</dc:creator>
    <dc:date>2023-11-22T11:26:53Z</dc:date>
    <item>
      <title>How to concatenate fields from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-fields-from-JSON/m-p/669444#M229605</link>
      <description>&lt;P&gt;I have an inputlookup table, in this lookup table there is a JSON array called "Evidence"&lt;/P&gt;&lt;P&gt;There is two field I would like to extract, one is "Rule" and the "Criticality". An example of Evidence array will look like this:&lt;/P&gt;&lt;P&gt;{"Evidence":[{"Rule":"Observed in the Wild Telemetry","Criticality":1},{"Rule":"Recent DDoS","Criticality":3}]}&lt;/P&gt;&lt;P&gt;So if I eval both "Rule" and Criticality" as shown below:&lt;/P&gt;&lt;P&gt;| eval "Rule"=spath(Evidence, "Evidence{}.Rule")&lt;BR /&gt;| eval "Criticality"=spath(Evidence, "Evidence{}.Criticality")&lt;BR /&gt;| table Rule Criticality&lt;BR /&gt;&lt;BR /&gt;The output will show like this but the Rule &amp;amp; Criticality column doesn't separate into different row (it is all in one row):&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;Rule&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;Criticality&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;Observed in the Wild Telemetry&lt;/DIV&gt;&lt;DIV class=""&gt;Recent DDoS&lt;/DIV&gt;&lt;/TD&gt;&lt;TD&gt;&lt;DIV class=""&gt;1&lt;/DIV&gt;&lt;DIV class=""&gt;3&lt;/DIV&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;Now the tricky part, I would like display the top count of Rule (top Rule limit=10)&amp;nbsp; but at the same time display the associated Criticality with the Rule. How do it? since the above does not separate into different row.&lt;BR /&gt;&lt;BR /&gt;The final outlook I am looking for, will look like this:&lt;/P&gt;&lt;TABLE border="1" width="100%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Rule&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Criticality&lt;/TD&gt;&lt;TD width="33.333333333333336%" height="25px"&gt;Count&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Observed in the Wild Telemetry&lt;/TD&gt;&lt;TD height="25px"&gt;1&lt;/TD&gt;&lt;TD height="25px"&gt;50&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD height="25px"&gt;Recent DDoS&lt;/TD&gt;&lt;TD height="25px"&gt;3&lt;/TD&gt;&lt;TD height="25px"&gt;2&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;BR /&gt;An alternative I was thinking was using foreach then concate it into a Combined Field, but I think It is kind of complex.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2023 11:26:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-fields-from-JSON/m-p/669444#M229605</guid>
      <dc:creator>BeeSpark</dc:creator>
      <dc:date>2023-11-22T11:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to concatenate fields from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-fields-from-JSON/m-p/669450#M229607</link>
      <description>&lt;LI-CODE lang="markup"&gt;| spath Evidence{} output=Evidence
| mvexpand Evidence
| spath input=Evidence
| stats count by Rule Criticality&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 22 Nov 2023 10:47:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-concatenate-fields-from-JSON/m-p/669450#M229607</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2023-11-22T10:47:42Z</dc:date>
    </item>
  </channel>
</rss>

