<?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: Why does &amp;quot;eventstats last()&amp;quot; fail for one column when I add mvlist=t after the transaction command? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217401#M63874</link>
    <description>&lt;P&gt;Did you sort this out?&lt;/P&gt;</description>
    <pubDate>Mon, 16 Jan 2017 16:51:55 GMT</pubDate>
    <dc:creator>snoobzilla</dc:creator>
    <dc:date>2017-01-16T16:51:55Z</dc:date>
    <item>
      <title>Why does "eventstats last()" fail for one column when I add mvlist=t after the transaction command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217398#M63871</link>
      <description>&lt;P&gt;In my search, I'm using a transaction. After that, I create a table from the results, then I want to apply an &lt;CODE&gt;eventstats last()&lt;/CODE&gt; function.&lt;BR /&gt;
In my table, I have two columns, let's say colA, and colB.&lt;BR /&gt;
If I'm running the transaction without any further arguments, the &lt;CODE&gt;last()&lt;/CODE&gt; function works for both columns, like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| transaction keyfield
| table colA, colB, keyfield
| eventstats last(colA) as last_colA, last(colB) as last_colB by keyfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, for another reason, I need to run the transaction with mvlist=t.&lt;BR /&gt;
When I do this, the eventstats function fails, but only for one column.&lt;BR /&gt;
In this case, fails for colA, but works fine with colB.&lt;/P&gt;

&lt;P&gt;I don't get what is the difference, since I'm having the same type of values in both columns.&lt;BR /&gt;
If it works for one column, why does it fail for the other one?&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jan 2017 15:19:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217398#M63871</guid>
      <dc:creator>szabados</dc:creator>
      <dc:date>2017-01-03T15:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why does "eventstats last()" fail for one column when I add mvlist=t after the transaction command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217399#M63872</link>
      <description>&lt;P&gt;Do you get single value for last_colA and last_colB columns OR multivalued fields? &lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:14:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217399#M63872</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2020-09-29T12:14:59Z</dc:date>
    </item>
    <item>
      <title>Re: Why does "eventstats last()" fail for one column when I add mvlist=t after the transaction command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217400#M63873</link>
      <description>&lt;P&gt;I am guessing that the issue here is something to do with multivalue fields. &lt;/P&gt;

&lt;P&gt;A couple of options come to mind, do eventstats first...&lt;/P&gt;

&lt;P&gt;| eventstats last(colA) as last_colA, last(colB) as last_colB by keyfield&lt;BR /&gt;
 | transaction keyfield&lt;BR /&gt;
 | table colA, colB, last_colA, last_colB, keyfield&lt;/P&gt;

&lt;P&gt;That said transaction and eventstats is REALLY REALLY inefficient. I would suggest eliminating transaction command altogether because it can be a monster resource hog and yield incomplete results when used for high volume searches. Eventstats is pretty brutal too.&lt;/P&gt;

&lt;P&gt;Alternatives...&lt;/P&gt;

&lt;P&gt;| stats list(colA) AS colA last(colA) as last_colA list(colB) AS colB last(colB) as last_colB by keyfield&lt;/P&gt;

&lt;P&gt;OR &lt;/P&gt;

&lt;P&gt;| stats list(colA) AS colA list(colB) AS colB by keyfield&lt;BR /&gt;
 | eval last_colA=mvindex(colA,-1)&lt;BR /&gt;
 | eval last_colB=mvindex(colB,-1)&lt;/P&gt;

&lt;P&gt;Let me know if this works and relative performance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:18:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217400#M63873</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2020-09-29T12:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Why does "eventstats last()" fail for one column when I add mvlist=t after the transaction command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217401#M63874</link>
      <description>&lt;P&gt;Did you sort this out?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jan 2017 16:51:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-does-quot-eventstats-last-quot-fail-for-one-column-when-I/m-p/217401#M63874</guid>
      <dc:creator>snoobzilla</dc:creator>
      <dc:date>2017-01-16T16:51:55Z</dc:date>
    </item>
  </channel>
</rss>

