<?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 extract a field out of JSON, and then use to get a count in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487899#M193869</link>
    <description>&lt;P&gt;Thank you very much mayurr98. Worked perfectly!&lt;/P&gt;</description>
    <pubDate>Mon, 25 Nov 2019 14:40:56 GMT</pubDate>
    <dc:creator>chktlm</dc:creator>
    <dc:date>2019-11-25T14:40:56Z</dc:date>
    <item>
      <title>How to extract a field out of JSON, and then use to get a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487897#M193867</link>
      <description>&lt;P&gt;Hi. I am trying to get a count on the first field within my logs, of the requestBody json input. Below is an example of the log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2019-11-20 17:20:03,802 INFO  [qqq1000000-10000] web.service.logging.IncomingRequest: ip=00.00.00.000, domain=http://url:0000/webService/web/Service/, username=null, date=[20/Nov/2019:17-20-03,802 +0000], method=POST uri=/webService/web/Service?schema=1.0&amp;amp;form=JSON&amp;amp;httpError=true&amp;amp;cid=12345, status=200, contentLength=68, responseTime=190, userAgent=WebServiceClient&amp;lt;Service&amp;gt; 3.5, referrer=, cacheStatus=miss, cid=12345 requestBody={"createPerson":{"customerId":"55555555.customer"}}, x-accountexternalid=987654321, api=service.create, x-partner=Partner, cid=12345
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;How would I grab the first entry in the JSON of the requestBody element, and then make that a field, so I can get a count. From the example above, I would want to grab &lt;EM&gt;createPerson&lt;/EM&gt; from the requestBody section. Make this a field so I can then grab a count of the incoming requestBody first element? There would be other fields besides just &lt;EM&gt;createPerson&lt;/EM&gt;. So I just want to extract that field within the quote, and get the count for each different element that is in that position of our incoming requests.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 17:39:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487897#M193867</guid>
      <dc:creator>chktlm</dc:creator>
      <dc:date>2019-11-20T17:39:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field out of JSON, and then use to get a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487898#M193868</link>
      <description>&lt;P&gt;try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...| rex "requestBody=\{\"(?&amp;lt;requestBody&amp;gt;\w+)" | stats count by requestBody
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 18:18:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487898#M193868</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-11-20T18:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract a field out of JSON, and then use to get a count</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487899#M193869</link>
      <description>&lt;P&gt;Thank you very much mayurr98. Worked perfectly!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Nov 2019 14:40:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-a-field-out-of-JSON-and-then-use-to-get-a-count/m-p/487899#M193869</guid>
      <dc:creator>chktlm</dc:creator>
      <dc:date>2019-11-25T14:40:56Z</dc:date>
    </item>
  </channel>
</rss>

