<?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 create an multivalue field after stats that don't include it? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340296#M100917</link>
    <description>&lt;P&gt;You beat me to my own answer but my approach was slightly different.  Waiting for the moderator to approve it but basically I used eventstats which keeps the other values:&lt;BR /&gt;
| eventstats count by User, Machine | mvcombine Function | eval Function=mvdedup(Function)&lt;/P&gt;</description>
    <pubDate>Mon, 12 Mar 2018 21:32:32 GMT</pubDate>
    <dc:creator>dj69</dc:creator>
    <dc:date>2018-03-12T21:32:32Z</dc:date>
    <item>
      <title>How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340292#M100913</link>
      <description>&lt;P&gt;Is there a way to aggregate data and then show additional fields as mv fields without running another search? I want to aggregate on only 2 fields but then show additional "thrown away" fields as multi value in the final results.&lt;/P&gt;

&lt;P&gt;Sample data:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User    Machine Function
Adam    1           x
Adam    1           y
Adam    1           y
Betty   2           x
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Working query: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats count by User, Machine, Function
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User    Machine     Function    Count
A       1           x           1
A       1           y           2
B       2           x           1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Tried query (doesn't work):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;stats count by User, Machine | mvcombine Function | stats sum(Count), User, Machine, Function
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Desired results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;User    Machine     Function    Count
A       1           x           3
                      y
B       2           x           1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340292#M100913</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T21:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340293#M100914</link>
      <description>&lt;P&gt;I pasted the wrong "tried" query but it doesn't really matter.  I'm just trying to show that I can't use mvcombine once stats throws away the other fields.  The alternative, to mvcombine at the end, can't combine if the Count column changes.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:16:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340293#M100914</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T21:16:53Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340294#M100915</link>
      <description>&lt;P&gt;Actually I think I just answered my own question, eventstats keeps the data in a form I can combine:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;eventstats count by User, Machine | mvcombine Function
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Function    Machine User    count
x           1       Adam    3
y
y
x           2       Betty   1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:27:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340294#M100915</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T21:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340295#M100916</link>
      <description>&lt;P&gt;I think this query will get you the table you want:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(Function) AS Function, count AS Count BY User, Machine
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:29:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340295#M100916</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-12T21:29:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340296#M100917</link>
      <description>&lt;P&gt;You beat me to my own answer but my approach was slightly different.  Waiting for the moderator to approve it but basically I used eventstats which keeps the other values:&lt;BR /&gt;
| eventstats count by User, Machine | mvcombine Function | eval Function=mvdedup(Function)&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:32:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340296#M100917</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T21:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340297#M100918</link>
      <description>&lt;P&gt;So now my question, which approach is "better" as far as query costs would be concerned?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 21:34:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340297#M100918</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T21:34:59Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340298#M100919</link>
      <description>&lt;P&gt;A similar query over a week's worth of my real data shows 260 seconds for the eventstats version and 330 seconds for the values version.  Yours is simpler to write but not as quick.  Will confirm by running both again though.  &lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 22:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340298#M100919</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T22:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340299#M100920</link>
      <description>&lt;P&gt;You can certainly test both approaches over your data set to see which completes more efficiently, but I'm pretty sure my approach is more efficient. Stats is almost always more efficient than eventstats, I believe, specifically because it discards extra fields immediately.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 22:16:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340299#M100920</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-12T22:16:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340300#M100921</link>
      <description>&lt;P&gt;Eventstats with many other fields has to be cleaned up, however by removing _* fields and specifying the exact fields to keep, so it becomes:&lt;BR /&gt;
eventstats count by User, Machine | fields Count, User, Machine, Function | fields - _* |  mvcombine Function | eval Function=mvdedup(Function) | sort -Count&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 22:17:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340300#M100921</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T22:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340301#M100922</link>
      <description>&lt;P&gt;I would have thought the same, but wanted to know for sure.&lt;/P&gt;

&lt;P&gt;So I've run each version of the query over and over again, both for short durations and for long.  The variability of server responses while everyone else is running queries makes this hard to test.  However, when running them simultaneously, they are mostly in a dead heat (~977 seconds over 30 days, ~10-15 seconds over 4 hours).&lt;/P&gt;

&lt;P&gt;When running one of them over and over again, and then doing the same with the other, the average performance of the eventstats is slightly better.  I think what might be going on is that while eventstats is using more memory during the query, this doesn't cost much in the way of performance.  Stats values, on the other hand, might be wasting performance in upkeep while it throws things away.&lt;/P&gt;</description>
      <pubDate>Mon, 12 Mar 2018 23:20:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340301#M100922</guid>
      <dc:creator>dj69</dc:creator>
      <dc:date>2018-03-12T23:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create an multivalue field after stats that don't include it?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340302#M100923</link>
      <description>&lt;P&gt;Fair enough! Thanks for running the experiments and sharing your results. I've definitely found with Splunk that it's worth the time to run experiments like this up front to tune my approaches, because what works well for one data set may not be as efficient for another. So you're very smart to set up these A/B tests and choose your final approach accordingly.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Mar 2018 01:17:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-create-an-multivalue-field-after-stats-that-don-t/m-p/340302#M100923</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-03-13T01:17:44Z</dc:date>
    </item>
  </channel>
</rss>

