<?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 count by command on repeating field values in event in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459007#M129629</link>
    <description>&lt;P&gt;Be sure to click &lt;CODE&gt;Accept&lt;/CODE&gt; to close the quesgion!&lt;/P&gt;</description>
    <pubDate>Tue, 16 Jul 2019 09:40:25 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2019-07-16T09:40:25Z</dc:date>
    <item>
      <title>How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458997#M129619</link>
      <description>&lt;P&gt;Good afternoon, &lt;/P&gt;

&lt;P&gt;I have a question on a search. I have events in which there are several orders. Inside of the customers field there are orders that look like this:  &lt;CODE&gt;["",""] --&amp;gt; ["3SYPFB009006802","3089"]&lt;/CODE&gt;. Within the ordernumber there also is a customercode. This is the part in the ordernumber behind the 3S that consists of letters. In example: &lt;STRONG&gt;3SYPFB009006802 --&amp;gt; customercode = YPFB&lt;/STRONG&gt;. What I want to achieve is do a count on the orders within the customers part grouped by customercode. Below you find three example events.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{"barcodes":{"ers":[],"ips":[],"customers":[["3SYPFB009006804","3089"],["3SYPFB009006802","3089"],["3SYPFB009006807","3089"]],"abs":[]}}
Show syntax highlighted

{"barcodes":{"ers":[],"ips":[],"customers":[["3SYQPU009165784","3085"],["3SYQPU009165819","3085"],["3SYQPU009165790","3085"]]}}
Show syntax highlighted

{"barcodes":{"ers":[],"ips":[],"customers":[["3SORG25943792","3085"],["3SORG25942905","3085"],["3SORG25942822","3085"]]}}
Show syntax highlighted

I have made a field extraction that extracts only the customers part: the values of the customers field look like this: 

["3SBUSD13339293","2929"],["3SBUSD13341744","2929"],["3SBUSD13341923","2929"]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;After that I want to extract the seperate orders from the customers field. For this I use the search below:&lt;/P&gt;

&lt;P&gt;index=index1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=customers max_match=0 "(?\[\"[A-Z|\d]{1,20}\"\,\"\d{4}\"\])" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The values on the order field look like this: ["3SFTVC0014757","2285"]&lt;/P&gt;

&lt;P&gt;From this field I want to extract the customercode. For this I use the search below:&lt;/P&gt;

&lt;P&gt;index=index1&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=customers max_match=0 "(?\[\"[A-Z|\d]{1,20}\"\,\"\d{4}\"\])" 
| rex field=order max_match=0 "\[\"[23]S(?[A-Z]{1,5})" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;From this, the values on the customercode field look like I would expect: for example: YPFB &lt;/P&gt;

&lt;P&gt;Then when I try to do a count on orders by customercode, the count results in values that are way to high. I use the search below:&lt;/P&gt;

&lt;P&gt;index=index1 &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rex field=customers max_match=0 "(?\[\"[A-Z|\d]{1,20}\"\,\"\d{4}\"\])" 
| rex field=order max_match=0 "\[\"[23]S(?[A-Z]{1,5})"
| stats count(order) by customercode
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I do a count on the orders, I get a total of 10752. If I do the same count grouped by customercode, the sum of the values are way higher. One customer code for example has a count(order) value of 22231.  &lt;/P&gt;

&lt;P&gt;Do you have any idea what is causing the issue and if it is possible to fix this by changing my search?&lt;/P&gt;

&lt;P&gt;Thanks, kind regards,&lt;BR /&gt;
Willem Jongeneel&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 14:39:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458997#M129619</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-07-10T14:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458998#M129620</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="{\"barcodes\":{\"ers\":[],\"ips\":[],\"customers\":[[\"3SYPFB009006804\",\"3089\"],[\"3SYPFB009006802\",\"3089\"],[\"3SYPFB009006807\",\"3089\"]],\"abs\":[]}}:::{\"barcodes\":{\"ers\":[],\"ips\":[],\"customers\":[[\"3SYQPU009165784\",\"3085\"],[\"3SYQPU009165819\",\"3085\"],[\"3SYQPU009165790\",\"3085\"]]}}:::{\"barcodes\":{\"ers\":[],\"ips\":[],\"customers\":[[\"3SORG25943792\",\"3085\"],[\"3SORG25942905\",\"3085\"],[\"3SORG25942822\",\"3085\"]]}}" 
| makemv delim=":::" raw 
| mvexpand raw 
| rename raw AS _raw 
| rex field=_raw ",\"customers\":\[(?&amp;lt;customers&amp;gt;.*?\])\](?:,|})"

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| rex field=customers max_match=0 "(?&amp;lt;order&amp;gt;\[\"[A-Z|\d]{1,20}\",\"\d{4}\"\])" 
| rex field=order max_match=0 "\[\"[23]S(?&amp;lt;customercode&amp;gt;[A-Z]{1,5})"
| eval customercode=mvdedup(customercode)
| stats dc(order) by customercode
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 17:01:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458998#M129620</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-10T17:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458999#M129621</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thank you for your response.&lt;/P&gt;

&lt;P&gt;I've tried the suggestion above. I still see a big difference. When i count the orders,  as compared to the sum of the count by customercode. When I count orders I count around 30.000 in an hour, the sum of the count by customercode is around 75.000.  &lt;/P&gt;

&lt;P&gt;Any idea on what might be wrong? &lt;/P&gt;

&lt;P&gt;Thanks, kind regards,&lt;BR /&gt;
Willem Jongeneel&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 08:53:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/458999#M129621</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-07-11T08:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459000#M129622</link>
      <description>&lt;P&gt;My code does the right thing according to the events that you provided.  You are going to have to provide a set of events where it does not work.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 14:46:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459000#M129622</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-11T14:46:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459001#M129623</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Below you find three sample events. When I count on ordernumbers (bcode) by using the search below I get 126 results for the customers part: &lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval raw=""&lt;BR /&gt;
| makemv delim=":::" raw &lt;BR /&gt;
| mvexpand raw &lt;BR /&gt;
| rename raw AS _raw &lt;BR /&gt;
| rex field=_raw ",\"customers\":[(?.*?])](?:,|})" &lt;BR /&gt;
| rename COMMENT AS "Everything above generates sample event data; everything below is your solution" &lt;BR /&gt;
| rex max_match=0 field=customers "\"(?[^\"]+)\",\"(?\d+)" &lt;BR /&gt;
| stats count(bcode)&lt;/P&gt;

&lt;P&gt;When I use the count by order query, the sum of the values is alot higher than 126 (1034).&lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
 | eval raw=""&lt;BR /&gt;
 | makemv delim=":::" raw &lt;BR /&gt;
 | mvexpand raw &lt;BR /&gt;
 | rename raw AS _raw &lt;BR /&gt;
 | rex field=_raw ",\"customers\":[(?.*?])](?:,|})"&lt;BR /&gt;
 | rename COMMENT AS "Everything above generates sample event data; everything below is your solution"&lt;BR /&gt;
 | rex field=customers max_match=0 "(?[\"[A-Z|\d]{1,20}\",\"\d{4}\"])" &lt;BR /&gt;
 | rex field=order max_match=0 "[\"[23]S(?[A-Z]{1,5})"&lt;BR /&gt;
 | eval customercode=mvdedup(customercode)&lt;BR /&gt;
 | stats dc(order) by customercode&lt;/P&gt;

&lt;P&gt;I'll add the events in another comment (insufficient characters left).&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 01:18:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459001#M129623</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2020-09-30T01:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459002#M129624</link>
      <description>&lt;P&gt;In both queries I used the events below: &lt;/P&gt;

&lt;P&gt;| eval raw="{\"barcodes\":{\"ers\":[[\"3SERS03668556\",\"9950\"],[\"3SERS03667778\",\"9950\"],[\"3SERS03666818\",\"9950\"],[\"3SERS03667300\",\"9950\"],[\"3SERS03667449\",\"9950\"],[\"3SERS03668284\",\"9950\"],[\"3SERS03667399\",\"9950\"],[\"3SERS03668210\",\"9950\"],[\"3SERS03668924\",\"9950\"],[\"3SERS03668642\",\"9950\"],[\"3SERS03668669\",\"9950\"],[\"3SERS03668585\",\"9950\"],[\"3SERS03668796\",\"9950\"],[\"3SERS03668834\",\"9950\"],[\"3SERS03668268\",\"9950\"],[\"3SERS03667620\",\"9950\"],[\"3SERS03668925\",\"9950\"],[\"3SERS03667742\",\"9950\"]],\"ips\":[],\"customers\":[[\"3STPWH732291032\",\"3085\"],[\"3STPWH838415231\",\"3085\"],[\"3STPWH826125705\",\"3085\"],[\"3STPWH773669416\",\"3085\"],[\"3STPWH841015805\",\"3085\"],[\"3STPWH033127663\",\"3085\"],[\"3STPWH663216254\",\"3085\"],[\"3STPWH8048381\",\"4944\"],[\"3STTZY000082868\",\"3085\"],[\"3STTZY000082870\",\"3085\"],[\"3STTZY000082869\",\"3085\"],[\"3SETAM003221384\",\"3085\"],[\"3SDKJA000045004\",\"4946\"],[\"3SDKJA000044983\",\"4946\"],[\"3SDKJA000044962\",\"3085\"],[\"3SDKJA000044933\",\"4946\"],[\"3SDKJA000044951\",\"3085\"],[\"3SDKJA000044997\",\"4946\"],[\"3SDKJA000045007\",\"4946\"],[\"3SDKJA000044904\",\"4946\"],[\"3SDKJA000044959\",\"3085\"],[\"3SETAM003221379\",\"3085\"],[\"3SHEUK00511962\",\"3085\"],[\"3SHEUK00511966\",\"3085\"],[\"3SHEUK00511964\",\"3085\"],[\"3SHEUK00511972\",\"3085\"],[\"3SHEUK00511967\",\"3085\"],[\"3SHEUK00511973\",\"3085\"],[\"3SHEDU10318238\",\"3085\"],[\"3SYTIE17462114\",\"3533\"],[\"3SYTIE17462165\",\"3085\"],[\"3SYTIE17460021\",\"3085\"],[\"3SHGBE000000938\",\"4946\"]],\"abs\":[[\"3SYTIE17462165\",\"3085\"],[\"3STPWH8048381\",\"4944\"],[\"3SYTIE17462114\",\"3533\"],[\"3SHGBE000000938\",\"4946\"],[\"3SYTIE17460021\",\"3085\"],[\"3STPWH826125705\",\"3085\"],[\"3STPWH773669416\",\"3085\"],[\"3STPWH732291032\",\"3085\"],[\"3STPWH841015805\",\"3085\"],[\"3STPWH838415231\",\"3085\"],[\"3STPWH033127663\",\"3085\"],[\"3STPWH663216254\",\"3085\"],[\"3SERS03668556\",\"9950\"],[\"3SERS03667778\",\"9950\"],[\"3SERS03666818\",\"9950\"],[\"3SERS03667300\",\"9950\"],[\"3SERS03667449\",\"9950\"],[\"3SERS03668284\",\"9950\"],[\"3SERS03667399\",\"9950\"],[\"3SERS03668210\",\"9950\"],[\"3SERS03668924\",\"9950\"],[\"3SERS03668642\",\"9950\"],[\"3SERS03668669\",\"9950\"],[\"3SERS03668585\",\"9950\"],[\"3SERS03668796\",\"9950\"],[\"3SERS03668834\",\"9950\"],[\"3SERS03668268\",\"9950\"],[\"3SERS03667620\",\"9950\"],[\"3SERS03668925\",\"9950\"],[\"3SERS03667742\",\"9950\"],[\"3STKQN00129430\",\"3189\"],[\"3STKQN00129431\",\"3189\"],[\"3SHEUK00511970\",\"3085\"],[\"3SHEUK00511969\",\"3085\"],[\"3SHEUK00511975\",\"3085\"],[\"3SHEUK00511976\",\"3085\"],[\"3SHEUK00511963\",\"3085\"],[\"3SHEUK00511977\",\"3085\"],[\"3SHEUK00511962\",\"3085\"],[\"3SHEUK00511966\",\"3085\"],[\"3SHEUK00511974\",\"3085\"],[\"3SHEUK00511965\",\"3085\"],[\"3SHEUK00511964\",\"3085\"],[\"3SHEUK00511968\",\"3085\"],[\"3SHEUK00511971\",\"3085\"],[\"3SHEUK00511972\",\"3085\"],[\"3SHEUK00511967\",\"3085\"],[\"3SHEUK00511973\",\"3085\"],[\"3SHEDU10318238\",\"3085\"]]}}:::{\"barcodes\":{\"ers\":[[\"3SERS03668450\",\"9950\"],[\"3SERS03667515\",\"9950\"],[\"3SERS03668573\",\"9950\"],[\"3SERS03668576\",\"9950\"],[\"3SERS03668802\",\"9950\"],[\"3SERS03668882\",\"9950\"]],\"ips\":[],\"customers\":[[\"3SYTIE17462113\",\"2928\"],[\"LX400221966NL\",\"9980\"],[\"LX400222025NL\",\"9980\"],[\"LX400221935NL\",\"9980\"],[\"LX400221881NL\",\"9980\"],[\"LX400221983NL\",\"9980\"],[\"LX400221970NL\",\"9980\"],[\"LX400221895NL\",\"9980\"],[\"LX400221918NL\",\"9980\"],[\"LX400221952NL\",\"9980\"],[\"LX400221997NL\",\"9980\"],[\"LX400222003NL\",\"9980\"],[\"LX400221949NL\",\"9980\"],[\"LX400221904NL\",\"9980\"],[\"LX400222017NL\",\"9980\"],[\"LX400221921NL\",\"9980\"],[\"3STFEG009021544\",\"3085\"],[\"3SYTIE17462170\",\"3533\"],[\"3STMLD004226307\",\"3791\"],[\"3STMLD004226308\",\"3791\"],[\"3SYTIE17462174\",\"3085\"],[\"3SYTIE17462146\",\"3085\"],[\"3SYTIE17462068\",\"3085\"],[\"3SYTIE17462076\",\"3085\"],[\"3SYTIE17462120\",\"3085\"],[\"3SYTIE17462133\",\"3085\"],[\"3SYTIE17462084\",\"3085\"],[\"3SYTIE17462171\",\"4940\"],[\"3STVVF000022929\",\"2929\"],[\"3STVVF000022927\",\"2929\"],[\"3STVVF000022966\",\"2929\"],[\"3STVVF000022961\",\"2929\"],[\"3STVVF000022943\",\"2929\"],[\"3STMLD004226309\",\"3790\"],[\"3SETAM003221388\",\"3085\"],[\"3SETAM003221386\",\"3085\"],[\"3SETAM003221389\",\"3085\"],[\"3SETAM003221383\",\"3085\"],[\"3SETAM003221381\",\"3085\"],[\"3STOWL009028771\",\"3089\"]],\"abs\":[[\"3SETAM003221384\",\"3085\"],[\"3SETAM003221388\",\"3085\"],[\"3SETAM003221379\",\"3085\"],[\"3SDKJA000044997\",\"4946\"],[\"3SDKJA000045004\",\"4946\"],[\"3SDKJA000044983\",\"4946\"],[\"3SDKJA000045007\",\"4946\"],[\"3SDKJA000044904\",\"4946\"],[\"3SDKJA000044962\",\"3085\"],[\"3SDKJA000044959\",\"3085\"],[\"3SDKJA000044933\",\"4946\"],[\"3SDKJA000044951\",\"3085\"],[\"3SETAM003221386\",\"3085\"],[\"3SETAM003221389\",\"3085\"],[\"3SETAM003221383\",\"3085\"],[\"3SETAM003221381\",\"3085\"],[\"3STOWL009028771\",\"3089\"],[\"3SYTIE17462113\",\"2928\"],[\"3STFEG009021544\",\"3085\"],[\"LX400221966NL\",\"9980\"],[\"LX400222025NL\",\"9980\"],[\"LX400221935NL\",\"9980\"],[\"LX400221881NL\",\"9980\"],[\"LX400221970NL\",\"9980\"],[\"LX400221918NL\",\"9980\"],[\"LX400221997NL\",\"9980\"],[\"LX400221904NL\",\"9980\"],[\"LX400222017NL\",\"9980\"],[\"LX400221983NL\",\"9980\"],[\"LX400221895NL\",\"9980\"],[\"LX400221952NL\",\"9980\"],[\"LX400222003NL\",\"9980\"],[\"LX400221949NL\",\"9980\"],[\"LX400221921NL\",\"9980\"],[\"3SYTIE17462170\",\"3533\"],[\"3STMLD004226307\",\"3791\"],[\"3STMLD004226308\",\"3791\"],[\"3SYTIE17462174\",\"3085\"],[\"3SYTIE17462146\",\"3085\"],[\"3SYTIE17462068\",\"3085\"],[\"3SYTIE17462076\",\"3085\"],[\"3SYTIE17462120\",\"3085\"],[\"3SYTIE17462133\",\"3085\"],[\"3SYTIE17462084\",\"3085\"],[\"3SYTIE17462171\",\"4940\"],[\"3SERS03668450\",\"9950\"],[\"3SERS03667515\",\"9950\"],[\"3SERS03668573\",\"9950\"],[\"3STTZY000082868\",\"3085\"],[\"3STTZY000082870\",\"3085\"],[\"3STTZY000082869\",\"3085\"],[\"3SERS03668576\",\"9950\"],[\"3SERS03668802\",\"9950\"],[\"3SERS03668882\",\"9950\"]]}}:::{\"barcodes\":{\"ers\":[],\"ips\":[],\"customers\":[[\"3SPROM003221376\",\"3085\"],[\"3SPROM003221382\",\"3085\"],[\"3SPROM003221378\",\"3085\"],[\"3SPROM003221380\",\"3085\"],[\"3SYEOU009068286\",\"3085\"],[\"3SYEOU009068287\",\"3085\"],[\"3SYEOU9068285\",\"4940\"],[\"3SDOKC000065672\",\"3189\"],[\"3SDOKC000065675\",\"3189\"],[\"3SDOKC000065670\",\"3189\"],[\"3SDOKC0188908\",\"4944\"],[\"3SDOKC000065669\",\"3085\"],[\"3SDOKC000065674\",\"3085\"],[\"3SDOKC0188909\",\"4944\"],[\"3SDOKC000065671\",\"3085\"],[\"3SDOKC000065673\",\"3085\"],[\"3SDOKC0188907\",\"4944\"],[\"3SYTIE17462150\",\"3085\"],[\"3SYTIE17462149\",\"2928\"],[\"3SYTIE17462147\",\"3085\"],[\"3SYTIE17462159\",\"3085\"],[\"3SYTIE17462152\",\"3085\"],[\"3SYTIE17462148\",\"3085\"],[\"3SYTIE17462157\",\"3085\"],[\"3SYTIE17462115\",\"3533\"],[\"3SCBLU3344225\",\"3089\"],[\"3SCBLU3344226\",\"3533\"],[\"3SCBLU3344223\",\"3085\"],[\"3SCBLU3344352\",\"3089\"],[\"3SCBLU3344354\",\"3089\"],[\"3SCBLU3344222\",\"3085\"],[\"3SCBLU3344356\",\"3089\"],[\"3SYTIE17462151\",\"3089\"],[\"3SCBRT3344350\",\"3240\"],[\"3SCBRT3344351\",\"3240\"],[\"3SCBRT3344487\",\"3240\"],[\"3SCBRT3344353\",\"3240\"],[\"3SCBRT3344529\",\"3240\"],[\"3SYEEZ000117428\",\"3085\"],[\"3STKQN00129430\",\"3189\"],[\"3STKQN00129431\",\"3189\"],[\"3SHEUK00511975\",\"3085\"],[\"3SHEUK00511974\",\"3085\"],[\"3SHEUK00511965\",\"3085\"],[\"3SHEUK00511968\",\"3085\"],[\"3SHEUK00511971\",\"3085\"],[\"3SHEUK00511970\",\"3085\"],[\"3SHEUK00511969\",\"3085\"],[\"3SHEUK00511976\",\"3085\"],[\"3SHEUK00511963\",\"3085\"],[\"3SHEUK00511977\",\"3085\"],[\"3STMLD004226303\",\"3653\"],[\"3STMLD004226304\",\"3653\"]],\"abs\":[[\"3SPROM003221376\",\"3085\"],[\"3SPROM003221382\",\"3085\"],[\"3SYEOU009068287\",\"3085\"],[\"3SYEOU009068286\",\"3085\"],[\"3SPROM003221378\",\"3085\"],[\"3SPROM003221380\",\"3085\"],[\"3SYEOU9068285\",\"4940\"],[\"3SDOKC000065675\",\"3189\"],[\"3SDOKC000065670\",\"3189\"],[\"3SDOKC000065672\",\"3189\"],[\"3SDOKC0188908\",\"4944\"],[\"3SDOKC000065669\",\"3085\"],[\"3SDOKC000065674\",\"3085\"],[\"3SDOKC0188909\",\"4944\"],[\"3SDOKC000065671\",\"3085\"],[\"3SDOKC000065673\",\"3085\"],[\"3SDOKC0188907\",\"4944\"],[\"3SYTIE17462150\",\"3085\"],[\"3SYTIE17462149\",\"2928\"],[\"3SYTIE17462147\",\"3085\"],[\"3SYTIE17462159\",\"3085\"],[\"3SYTIE17462152\",\"3085\"],[\"3SYTIE17462148\",\"3085\"],[\"3SYTIE17462157\",\"3085\"],[\"3SCBLU3344225\",\"3089\"],[\"3SCBLU3344226\",\"3533\"],[\"3SCBLU3344223\",\"3085\"],[\"3SCBLU3344352\",\"3089\"],[\"3SCBLU3344354\",\"3089\"],[\"3SCBLU3344222\",\"3085\"],[\"3SCBLU3344356\",\"3089\"],[\"3SYTIE17462115\",\"3533\"],[\"3SYTIE17462151\",\"3089\"],[\"3SCBRT3344529\",\"3240\"],[\"3SCBRT3344350\",\"3240\"],[\"3SCBRT3344351\",\"3240\"],[\"3SCBRT3344487\",\"3240\"],[\"3SCBRT3344353\",\"3240\"],[\"3SYEEZ000117428\",\"3085\"],[\"3SCAZL0020631\",\"3189\"],[\"3SCAZL0020644\",\"3189\"],[\"3SCAZL0020618\",\"3189\"],[\"3SCAZL0020683\",\"3189\"],[\"3SCAZL0020625\",\"3189\"],[\"3SCAZL0020670\",\"3189\"],[\"3STMLD004226304\",\"3653\"],[\"3STMLD004226303\",\"3653\"]]}}"&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 07:17:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459002#M129624</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-07-15T07:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459003#M129625</link>
      <description>&lt;P&gt;OK, so what are you getting and what do you think the correct answer is?&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 14:50:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459003#M129625</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-15T14:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459004#M129626</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Within the customers part there are 126 orders. Each order has one customercode. If I would count the orders by customercode, I would expect that the values would add up to 126 aswell. But this does not seem to happen as the sum of customercode values is 1034.  &lt;/P&gt;

&lt;P&gt;Kind regards,&lt;BR /&gt;
Willem&lt;/P&gt;</description>
      <pubDate>Mon, 15 Jul 2019 17:32:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459004#M129626</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-07-15T17:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459005#M129627</link>
      <description>&lt;P&gt;How about this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval raw="{\"barcodes\":{\"ers\":[[\"3SERS03668556\",\"9950\"],[\"3SERS03667778\",\"9950\"],[\"3SERS03666818\",\"9950\"],[\"3SERS03667300\",\"9950\"],[\"3SERS03667449\",\"9950\"],[\"3SERS03668284\",\"9950\"],[\"3SERS03667399\",\"9950\"],[\"3SERS03668210\",\"9950\"],[\"3SERS03668924\",\"9950\"],[\"3SERS03668642\",\"9950\"],[\"3SERS03668669\",\"9950\"],[\"3SERS03668585\",\"9950\"],[\"3SERS03668796\",\"9950\"],[\"3SERS03668834\",\"9950\"],[\"3SERS03668268\",\"9950\"],[\"3SERS03667620\",\"9950\"],[\"3SERS03668925\",\"9950\"],[\"3SERS03667742\",\"9950\"]],\"ips\":[],\"customers\":[[\"3STPWH732291032\",\"3085\"],[\"3STPWH838415231\",\"3085\"],[\"3STPWH826125705\",\"3085\"],[\"3STPWH773669416\",\"3085\"],[\"3STPWH841015805\",\"3085\"],[\"3STPWH033127663\",\"3085\"],[\"3STPWH663216254\",\"3085\"],[\"3STPWH8048381\",\"4944\"],[\"3STTZY000082868\",\"3085\"],[\"3STTZY000082870\",\"3085\"],[\"3STTZY000082869\",\"3085\"],[\"3SETAM003221384\",\"3085\"],[\"3SDKJA000045004\",\"4946\"],[\"3SDKJA000044983\",\"4946\"],[\"3SDKJA000044962\",\"3085\"],[\"3SDKJA000044933\",\"4946\"],[\"3SDKJA000044951\",\"3085\"],[\"3SDKJA000044997\",\"4946\"],[\"3SDKJA000045007\",\"4946\"],[\"3SDKJA000044904\",\"4946\"],[\"3SDKJA000044959\",\"3085\"],[\"3SETAM003221379\",\"3085\"],[\"3SHEUK00511962\",\"3085\"],[\"3SHEUK00511966\",\"3085\"],[\"3SHEUK00511964\",\"3085\"],[\"3SHEUK00511972\",\"3085\"],[\"3SHEUK00511967\",\"3085\"],[\"3SHEUK00511973\",\"3085\"],[\"3SHEDU10318238\",\"3085\"],[\"3SYTIE17462114\",\"3533\"],[\"3SYTIE17462165\",\"3085\"],[\"3SYTIE17460021\",\"3085\"],[\"3SHGBE000000938\",\"4946\"]],\"abs\":[[\"3SYTIE17462165\",\"3085\"],[\"3STPWH8048381\",\"4944\"],[\"3SYTIE17462114\",\"3533\"],[\"3SHGBE000000938\",\"4946\"],[\"3SYTIE17460021\",\"3085\"],[\"3STPWH826125705\",\"3085\"],[\"3STPWH773669416\",\"3085\"],[\"3STPWH732291032\",\"3085\"],[\"3STPWH841015805\",\"3085\"],[\"3STPWH838415231\",\"3085\"],[\"3STPWH033127663\",\"3085\"],[\"3STPWH663216254\",\"3085\"],[\"3SERS03668556\",\"9950\"],[\"3SERS03667778\",\"9950\"],[\"3SERS03666818\",\"9950\"],[\"3SERS03667300\",\"9950\"],[\"3SERS03667449\",\"9950\"],[\"3SERS03668284\",\"9950\"],[\"3SERS03667399\",\"9950\"],[\"3SERS03668210\",\"9950\"],[\"3SERS03668924\",\"9950\"],[\"3SERS03668642\",\"9950\"],[\"3SERS03668669\",\"9950\"],[\"3SERS03668585\",\"9950\"],[\"3SERS03668796\",\"9950\"],[\"3SERS03668834\",\"9950\"],[\"3SERS03668268\",\"9950\"],[\"3SERS03667620\",\"9950\"],[\"3SERS03668925\",\"9950\"],[\"3SERS03667742\",\"9950\"],[\"3STKQN00129430\",\"3189\"],[\"3STKQN00129431\",\"3189\"],[\"3SHEUK00511970\",\"3085\"],[\"3SHEUK00511969\",\"3085\"],[\"3SHEUK00511975\",\"3085\"],[\"3SHEUK00511976\",\"3085\"],[\"3SHEUK00511963\",\"3085\"],[\"3SHEUK00511977\",\"3085\"],[\"3SHEUK00511962\",\"3085\"],[\"3SHEUK00511966\",\"3085\"],[\"3SHEUK00511974\",\"3085\"],[\"3SHEUK00511965\",\"3085\"],[\"3SHEUK00511964\",\"3085\"],[\"3SHEUK00511968\",\"3085\"],[\"3SHEUK00511971\",\"3085\"],[\"3SHEUK00511972\",\"3085\"],[\"3SHEUK00511967\",\"3085\"],[\"3SHEUK00511973\",\"3085\"],[\"3SHEDU10318238\",\"3085\"]]}}:::{\"barcodes\":{\"ers\":[[\"3SERS03668450\",\"9950\"],[\"3SERS03667515\",\"9950\"],[\"3SERS03668573\",\"9950\"],[\"3SERS03668576\",\"9950\"],[\"3SERS03668802\",\"9950\"],[\"3SERS03668882\",\"9950\"]],\"ips\":[],\"customers\":[[\"3SYTIE17462113\",\"2928\"],[\"LX400221966NL\",\"9980\"],[\"LX400222025NL\",\"9980\"],[\"LX400221935NL\",\"9980\"],[\"LX400221881NL\",\"9980\"],[\"LX400221983NL\",\"9980\"],[\"LX400221970NL\",\"9980\"],[\"LX400221895NL\",\"9980\"],[\"LX400221918NL\",\"9980\"],[\"LX400221952NL\",\"9980\"],[\"LX400221997NL\",\"9980\"],[\"LX400222003NL\",\"9980\"],[\"LX400221949NL\",\"9980\"],[\"LX400221904NL\",\"9980\"],[\"LX400222017NL\",\"9980\"],[\"LX400221921NL\",\"9980\"],[\"3STFEG009021544\",\"3085\"],[\"3SYTIE17462170\",\"3533\"],[\"3STMLD004226307\",\"3791\"],[\"3STMLD004226308\",\"3791\"],[\"3SYTIE17462174\",\"3085\"],[\"3SYTIE17462146\",\"3085\"],[\"3SYTIE17462068\",\"3085\"],[\"3SYTIE17462076\",\"3085\"],[\"3SYTIE17462120\",\"3085\"],[\"3SYTIE17462133\",\"3085\"],[\"3SYTIE17462084\",\"3085\"],[\"3SYTIE17462171\",\"4940\"],[\"3STVVF000022929\",\"2929\"],[\"3STVVF000022927\",\"2929\"],[\"3STVVF000022966\",\"2929\"],[\"3STVVF000022961\",\"2929\"],[\"3STVVF000022943\",\"2929\"],[\"3STMLD004226309\",\"3790\"],[\"3SETAM003221388\",\"3085\"],[\"3SETAM003221386\",\"3085\"],[\"3SETAM003221389\",\"3085\"],[\"3SETAM003221383\",\"3085\"],[\"3SETAM003221381\",\"3085\"],[\"3STOWL009028771\",\"3089\"]],\"abs\":[[\"3SETAM003221384\",\"3085\"],[\"3SETAM003221388\",\"3085\"],[\"3SETAM003221379\",\"3085\"],[\"3SDKJA000044997\",\"4946\"],[\"3SDKJA000045004\",\"4946\"],[\"3SDKJA000044983\",\"4946\"],[\"3SDKJA000045007\",\"4946\"],[\"3SDKJA000044904\",\"4946\"],[\"3SDKJA000044962\",\"3085\"],[\"3SDKJA000044959\",\"3085\"],[\"3SDKJA000044933\",\"4946\"],[\"3SDKJA000044951\",\"3085\"],[\"3SETAM003221386\",\"3085\"],[\"3SETAM003221389\",\"3085\"],[\"3SETAM003221383\",\"3085\"],[\"3SETAM003221381\",\"3085\"],[\"3STOWL009028771\",\"3089\"],[\"3SYTIE17462113\",\"2928\"],[\"3STFEG009021544\",\"3085\"],[\"LX400221966NL\",\"9980\"],[\"LX400222025NL\",\"9980\"],[\"LX400221935NL\",\"9980\"],[\"LX400221881NL\",\"9980\"],[\"LX400221970NL\",\"9980\"],[\"LX400221918NL\",\"9980\"],[\"LX400221997NL\",\"9980\"],[\"LX400221904NL\",\"9980\"],[\"LX400222017NL\",\"9980\"],[\"LX400221983NL\",\"9980\"],[\"LX400221895NL\",\"9980\"],[\"LX400221952NL\",\"9980\"],[\"LX400222003NL\",\"9980\"],[\"LX400221949NL\",\"9980\"],[\"LX400221921NL\",\"9980\"],[\"3SYTIE17462170\",\"3533\"],[\"3STMLD004226307\",\"3791\"],[\"3STMLD004226308\",\"3791\"],[\"3SYTIE17462174\",\"3085\"],[\"3SYTIE17462146\",\"3085\"],[\"3SYTIE17462068\",\"3085\"],[\"3SYTIE17462076\",\"3085\"],[\"3SYTIE17462120\",\"3085\"],[\"3SYTIE17462133\",\"3085\"],[\"3SYTIE17462084\",\"3085\"],[\"3SYTIE17462171\",\"4940\"],[\"3SERS03668450\",\"9950\"],[\"3SERS03667515\",\"9950\"],[\"3SERS03668573\",\"9950\"],[\"3STTZY000082868\",\"3085\"],[\"3STTZY000082870\",\"3085\"],[\"3STTZY000082869\",\"3085\"],[\"3SERS03668576\",\"9950\"],[\"3SERS03668802\",\"9950\"],[\"3SERS03668882\",\"9950\"]]}}:::{\"barcodes\":{\"ers\":[],\"ips\":[],\"customers\":[[\"3SPROM003221376\",\"3085\"],[\"3SPROM003221382\",\"3085\"],[\"3SPROM003221378\",\"3085\"],[\"3SPROM003221380\",\"3085\"],[\"3SYEOU009068286\",\"3085\"],[\"3SYEOU009068287\",\"3085\"],[\"3SYEOU9068285\",\"4940\"],[\"3SDOKC000065672\",\"3189\"],[\"3SDOKC000065675\",\"3189\"],[\"3SDOKC000065670\",\"3189\"],[\"3SDOKC0188908\",\"4944\"],[\"3SDOKC000065669\",\"3085\"],[\"3SDOKC000065674\",\"3085\"],[\"3SDOKC0188909\",\"4944\"],[\"3SDOKC000065671\",\"3085\"],[\"3SDOKC000065673\",\"3085\"],[\"3SDOKC0188907\",\"4944\"],[\"3SYTIE17462150\",\"3085\"],[\"3SYTIE17462149\",\"2928\"],[\"3SYTIE17462147\",\"3085\"],[\"3SYTIE17462159\",\"3085\"],[\"3SYTIE17462152\",\"3085\"],[\"3SYTIE17462148\",\"3085\"],[\"3SYTIE17462157\",\"3085\"],[\"3SYTIE17462115\",\"3533\"],[\"3SCBLU3344225\",\"3089\"],[\"3SCBLU3344226\",\"3533\"],[\"3SCBLU3344223\",\"3085\"],[\"3SCBLU3344352\",\"3089\"],[\"3SCBLU3344354\",\"3089\"],[\"3SCBLU3344222\",\"3085\"],[\"3SCBLU3344356\",\"3089\"],[\"3SYTIE17462151\",\"3089\"],[\"3SCBRT3344350\",\"3240\"],[\"3SCBRT3344351\",\"3240\"],[\"3SCBRT3344487\",\"3240\"],[\"3SCBRT3344353\",\"3240\"],[\"3SCBRT3344529\",\"3240\"],[\"3SYEEZ000117428\",\"3085\"],[\"3STKQN00129430\",\"3189\"],[\"3STKQN00129431\",\"3189\"],[\"3SHEUK00511975\",\"3085\"],[\"3SHEUK00511974\",\"3085\"],[\"3SHEUK00511965\",\"3085\"],[\"3SHEUK00511968\",\"3085\"],[\"3SHEUK00511971\",\"3085\"],[\"3SHEUK00511970\",\"3085\"],[\"3SHEUK00511969\",\"3085\"],[\"3SHEUK00511976\",\"3085\"],[\"3SHEUK00511963\",\"3085\"],[\"3SHEUK00511977\",\"3085\"],[\"3STMLD004226303\",\"3653\"],[\"3STMLD004226304\",\"3653\"]],\"abs\":[[\"3SPROM003221376\",\"3085\"],[\"3SPROM003221382\",\"3085\"],[\"3SYEOU009068287\",\"3085\"],[\"3SYEOU009068286\",\"3085\"],[\"3SPROM003221378\",\"3085\"],[\"3SPROM003221380\",\"3085\"],[\"3SYEOU9068285\",\"4940\"],[\"3SDOKC000065675\",\"3189\"],[\"3SDOKC000065670\",\"3189\"],[\"3SDOKC000065672\",\"3189\"],[\"3SDOKC0188908\",\"4944\"],[\"3SDOKC000065669\",\"3085\"],[\"3SDOKC000065674\",\"3085\"],[\"3SDOKC0188909\",\"4944\"],[\"3SDOKC000065671\",\"3085\"],[\"3SDOKC000065673\",\"3085\"],[\"3SDOKC0188907\",\"4944\"],[\"3SYTIE17462150\",\"3085\"],[\"3SYTIE17462149\",\"2928\"],[\"3SYTIE17462147\",\"3085\"],[\"3SYTIE17462159\",\"3085\"],[\"3SYTIE17462152\",\"3085\"],[\"3SYTIE17462148\",\"3085\"],[\"3SYTIE17462157\",\"3085\"],[\"3SCBLU3344225\",\"3089\"],[\"3SCBLU3344226\",\"3533\"],[\"3SCBLU3344223\",\"3085\"],[\"3SCBLU3344352\",\"3089\"],[\"3SCBLU3344354\",\"3089\"],[\"3SCBLU3344222\",\"3085\"],[\"3SCBLU3344356\",\"3089\"],[\"3SYTIE17462115\",\"3533\"],[\"3SYTIE17462151\",\"3089\"],[\"3SCBRT3344529\",\"3240\"],[\"3SCBRT3344350\",\"3240\"],[\"3SCBRT3344351\",\"3240\"],[\"3SCBRT3344487\",\"3240\"],[\"3SCBRT3344353\",\"3240\"],[\"3SYEEZ000117428\",\"3085\"],[\"3SCAZL0020631\",\"3189\"],[\"3SCAZL0020644\",\"3189\"],[\"3SCAZL0020618\",\"3189\"],[\"3SCAZL0020683\",\"3189\"],[\"3SCAZL0020625\",\"3189\"],[\"3SCAZL0020670\",\"3189\"],[\"3STMLD004226304\",\"3653\"],[\"3STMLD004226303\",\"3653\"]]}}"
| makemv delim=":::" raw 
| mvexpand raw 
| rename raw AS _raw 
| rex field=_raw ",\"customers\":\[(?&amp;lt;customers&amp;gt;.*?\])\](?:,|})" 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution" 

| rex field=customers max_match=0 "(?&amp;lt;order&amp;gt;\[\"[A-Z|\d]{1,20}\",\"\d{4}\"\])" 
| rex field=order max_match=0 "\[\"[23]S(?&amp;lt;customercode&amp;gt;[A-Z]{1,5})"
| rex field=order mode=sed "s/^(\[\")(.{2})(.{4})(.+?)\",\"(\d+)\"\]/customer_code=\3,cutomer_order=\2\3\4,store_order=\5/"
| table _time order
| mvexpand order
| rename order AS _raw
| kv
| stats count by customer_code
| addtotals row=f col=t
| fillnull value="TOTAL"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Jul 2019 01:40:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459005#M129627</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-16T01:40:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459006#M129628</link>
      <description>&lt;P&gt;Great, this worked!&lt;/P&gt;

&lt;P&gt;Thank you for your help!&lt;/P&gt;

&lt;P&gt;Kind regards, &lt;BR /&gt;
Willem &lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 07:41:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459006#M129628</guid>
      <dc:creator>willemjongeneel</dc:creator>
      <dc:date>2019-07-16T07:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to count by command on repeating field values in event</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459007#M129629</link>
      <description>&lt;P&gt;Be sure to click &lt;CODE&gt;Accept&lt;/CODE&gt; to close the quesgion!&lt;/P&gt;</description>
      <pubDate>Tue, 16 Jul 2019 09:40:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-count-by-command-on-repeating-field-values-in-event/m-p/459007#M129629</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-07-16T09:40:25Z</dc:date>
    </item>
  </channel>
</rss>

