<?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 bucket sums of a multi-value array with values of another array? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313450#M93820</link>
    <description>&lt;P&gt;This is perfect! In my case, I have many sets of BucketSteps and BucketValue to work with so the first eval isn't needed but the rest is exactly what I has hoping for.&lt;/P&gt;

&lt;P&gt;In my use case I am carting out a specific timeframe (1 day, for example) so I don't need the time modifier and was able to use this:&lt;/P&gt;

&lt;P&gt;my search&lt;BR /&gt;
| eval splitBucketSteps=split(BucketSteps,",") &lt;BR /&gt;
| eval splitBucketValue=split(BucketValue,",") &lt;BR /&gt;
| eval temp=mvzip(splitBucketSteps,splitBucketValue,"##") &lt;BR /&gt;
| mvexpand temp &lt;BR /&gt;
| rex field=temp "(?.&lt;EM&gt;)##(?.&lt;/EM&gt;)"&lt;BR /&gt;
| table extractedBucketSteps extractedBucketValue&lt;BR /&gt;
| chart sum(extractedBucketValue) by extractedBucketSteps&lt;/P&gt;

&lt;P&gt;which formats to a nice, simple bar chart for my purposes. Thank you very much for the assist!&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jul 2017 18:04:01 GMT</pubDate>
    <dc:creator>jpolson</dc:creator>
    <dc:date>2017-07-14T18:04:01Z</dc:date>
    <item>
      <title>How to bucket sums of a multi-value array with values of another array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313447#M93817</link>
      <description>&lt;P&gt;I have some logging being generated that aggregates values for a user in a comma-separated sequence, and has a second field that lists bucketing values in another comma-separated field, like this:&lt;/P&gt;

&lt;P&gt;BucketSteps:     1,5,10,20,30,40,60,80,100,120,140,160,180,200,220,240,260,300,9999 &lt;BR /&gt;
BucketValue:     0,0,0,0,35,1382,16887,8412,1093,14,9,4,0,1,2,0,0,0,56  &lt;/P&gt;

&lt;P&gt;What I need to do is sum all events' bucket values and map them to the bucket step, so in this example 1382 needs to go in the 40 "bucket", 16887 in the 60 "bucket" and so on. &lt;/P&gt;

&lt;P&gt;I can separate these value strings just fine with split but I don't see a way of generating the buckets I need outside of a long string of evals mapping each bucket step to a new value, and each bucket value to a new value, then aggregating that way. That makes for a big, unpleasant query.&lt;/P&gt;

&lt;P&gt;Is there a more efficient way of working with these arrays that I am missing?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 16:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313447#M93817</guid>
      <dc:creator>jpolson</dc:creator>
      <dc:date>2017-07-14T16:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to bucket sums of a multi-value array with values of another array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313448#M93818</link>
      <description>&lt;P&gt;Check out &lt;CODE&gt;mvzip&lt;/CODE&gt;.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | eval Buckets=mvzip(BucketSteps, BucketValue) | ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jul 2017 17:20:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313448#M93818</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2017-07-14T17:20:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to bucket sums of a multi-value array with values of another array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313449#M93819</link>
      <description>&lt;P&gt;try something like this ,&lt;/P&gt;

&lt;P&gt;Sample, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval BucketSteps="1,5,10,20,30,40,60,80,100,120,140,160,180,200,220,240,260,300,9999"  | eval BucketValue="0,0,0,0,35,1382,16887,8412,1093,14,9,4,0,1,2,0,0,0,56" | eval splitBucketSteps=split(BucketSteps,",") | eval splitBucketValue=split(BucketValue,",") | eval temp=mvzip(splitBucketSteps,splitBucketValue,"##") | mvexpand temp | rex field=temp "(?&amp;lt;extractedBucketSteps&amp;gt;.*)##(?&amp;lt;extractedBucketValue&amp;gt;.*)" | table _time, extractedBucketSteps extractedBucketValue
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Explanation : &lt;/P&gt;

&lt;P&gt;make results, &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval BucketSteps="1,5,10,20,30,40,60,80,100,120,140,160,180,200,220,240,260,300,9999"  | eval BucketValue="0,0,0,0,35,1382,16887,8412,1093,14,9,4,0,1,2,0,0,0,56"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Split&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval splitBucketSteps=split(BucketSteps,",") | eval splitBucketValue=split(BucketValue,",") 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Merget BucketSteps and BucketValue,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval temp=mvzip(splitBucketSteps,splitBucketValue,"##") | mvexpand temp | rex field=temp "(?&amp;lt;extractedBucketSteps&amp;gt;.*)##(?&amp;lt;extractedBucketValue&amp;gt;.*)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Jul 2017 17:31:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313449#M93819</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2017-07-14T17:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to bucket sums of a multi-value array with values of another array?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313450#M93820</link>
      <description>&lt;P&gt;This is perfect! In my case, I have many sets of BucketSteps and BucketValue to work with so the first eval isn't needed but the rest is exactly what I has hoping for.&lt;/P&gt;

&lt;P&gt;In my use case I am carting out a specific timeframe (1 day, for example) so I don't need the time modifier and was able to use this:&lt;/P&gt;

&lt;P&gt;my search&lt;BR /&gt;
| eval splitBucketSteps=split(BucketSteps,",") &lt;BR /&gt;
| eval splitBucketValue=split(BucketValue,",") &lt;BR /&gt;
| eval temp=mvzip(splitBucketSteps,splitBucketValue,"##") &lt;BR /&gt;
| mvexpand temp &lt;BR /&gt;
| rex field=temp "(?.&lt;EM&gt;)##(?.&lt;/EM&gt;)"&lt;BR /&gt;
| table extractedBucketSteps extractedBucketValue&lt;BR /&gt;
| chart sum(extractedBucketValue) by extractedBucketSteps&lt;/P&gt;

&lt;P&gt;which formats to a nice, simple bar chart for my purposes. Thank you very much for the assist!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jul 2017 18:04:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-bucket-sums-of-a-multi-value-array-with-values-of-another/m-p/313450#M93820</guid>
      <dc:creator>jpolson</dc:creator>
      <dc:date>2017-07-14T18:04:01Z</dc:date>
    </item>
  </channel>
</rss>

