<?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 do I count fields inside a JSON array in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-fields-inside-a-JSON-array/m-p/454244#M128528</link>
    <description>&lt;P&gt;My co-worker finally got enough time to look at this for me.  The solution is&lt;/P&gt;

&lt;P&gt;| spath threatsInfoMap{} output=threatsElements &lt;BR /&gt;
| stats count(threatsElements) AS threatsElementsCount by _time&lt;/P&gt;</description>
    <pubDate>Fri, 22 Mar 2019 18:31:54 GMT</pubDate>
    <dc:creator>jwhughes58</dc:creator>
    <dc:date>2019-03-22T18:31:54Z</dc:date>
    <item>
      <title>How do I count fields inside a JSON array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-fields-inside-a-JSON-array/m-p/454243#M128527</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I have this data&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"quarantineFolder": null, "spamScore": 100, "threatsInfoMap": [{"campaignID": null, "threat": "http://weg-aus-dem-hamsterrad.de/r5romlp/verif.myacc.resourses.biz/", "threatUrl": "https://threatinsight.proofpoint.com/cac61cbd-474f-77be-4915-2f27623219e4/threat/email/38e20c3d0a5c30dae9cc53f0fb77099a536a879530d4ded89209eb68db8be620", "classification": "malware", "threatType": "url", "threatID": "38e20c3d0a5c30dae9cc53f0fb77099a536a879530d4ded89209eb68db8be620", "threatTime": "2019-03-21T19:36:06.000Z", "threatStatus": "active"}], "replyToAddress": [], "phishScore": 0, "eventType": "messagesBlocked", "toAddresses": [“xyzzy@company.com”], "policyRoutes": ["default_inbound", "Inbound"], "messageParts": [{"md5": "4e12ab62f710e02270e02fdfad9a1817", "oContentType": "text/plain", "contentType": "text/plain", "disposition": "inline", "sha256": "d97d9261a6f0795bec34f055b997b01ec5f02b71f28d71aa88da47883c6df023", "sandboxStatus": null, "filename": "text.txt"}, {"md5": "fddffa81e7b4fe62073e0aab0336af76", "oContentType": "text/html", "contentType": "text/html", "disposition": "inline", "sha256": "43649abeaa49d66a1f4c36577251fd0578d6852c867d6fa4d3c26155eede56b0", "sandboxStatus": null, "filename": "text.html"}], "fromAddress": [], "QID": "2rbvw7q840-1", "xmailer": null, "senderIP": “1.1.1.1”, "sender": “plugh@company2.com”, "quarantineRule": null, "ccAddresses": [], "completelyRewritten": false, "messageTime": "2019-03-21T19:36:03.000Z", "recipient": [“xyzzy@company.com”], "messageSize": 3892, "headerReplyTo": null, "modulesRun": ["access", "smtpsrv", "av", "zerohour", "spf", "dkimv", "sandbox", "spam", "dmarc", "pdr", "urldefense"], "cluster": “prod_host”, "impostorScore": 0.0, "headerFrom": “Narf &amp;lt;narf@company.com&amp;gt; &amp;lt;plugh@company2.com&amp;gt;”, "GUID": "V-5swmMYZHoDpbgyPsQ9tN9LtKfCwHUK", "malwareScore": 100, "messageID": "&amp;lt;8TJjwegKPa6rThF30mDqDCkVzV36CA8OoaMbImztyGguX8SRF7d@kp.org&amp;gt;", "subject": “Narf Transaction for your invoice"}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm seeing an issue where the sender value isn't extracted if the number of items in the threatsInfoMap is large.  Does someone have a suggestion for counting the items in the threatsInfoMap so I can see if this is what is happening?&lt;/P&gt;

&lt;P&gt;TIA,&lt;BR /&gt;
Joe&lt;/P&gt;</description>
      <pubDate>Thu, 21 Mar 2019 20:00:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-fields-inside-a-JSON-array/m-p/454243#M128527</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2019-03-21T20:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I count fields inside a JSON array</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-fields-inside-a-JSON-array/m-p/454244#M128528</link>
      <description>&lt;P&gt;My co-worker finally got enough time to look at this for me.  The solution is&lt;/P&gt;

&lt;P&gt;| spath threatsInfoMap{} output=threatsElements &lt;BR /&gt;
| stats count(threatsElements) AS threatsElementsCount by _time&lt;/P&gt;</description>
      <pubDate>Fri, 22 Mar 2019 18:31:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-count-fields-inside-a-JSON-array/m-p/454244#M128528</guid>
      <dc:creator>jwhughes58</dc:creator>
      <dc:date>2019-03-22T18:31:54Z</dc:date>
    </item>
  </channel>
</rss>

