<?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: Transaction after stats/table/eval/where? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Transaction-after-stats-table-eval-where/m-p/53211#M12934</link>
    <description>&lt;P&gt;No, once you've run a command that transforms the results in one way or another, the following commands in the search pipeline will only see the output of that command, so for instance after running &lt;CODE&gt;stats&lt;/CODE&gt; the following commands do not 'see' the original events.&lt;/P&gt;

&lt;P&gt;What you could do though is to put this in a subsearch for getting the userId's that you want to report on first, and then return those to the main search where you get the times for each of those userId's:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="thesource" A="enterEvent" [search source="thesource" A="enterEvent"  | stats first(_time) as firstime last(_time)  as lastime  by userId | table firstime lastime userId | eval time_difference=(lastime-firstime)/3600 | where diff&amp;gt;"12" | fields userId] | table _time userId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 16 May 2012 16:46:48 GMT</pubDate>
    <dc:creator>Ayn</dc:creator>
    <dc:date>2012-05-16T16:46:48Z</dc:date>
    <item>
      <title>Transaction after stats/table/eval/where?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-after-stats-table-eval-where/m-p/53210#M12933</link>
      <description>&lt;P&gt;Hi, is it possible to manipulate the events of a query with a transaction after using stats/table/eval/where?&lt;BR /&gt;
the events are kept no matter what I do to them in the query, maybe they reduce in numbers but the remaining results are the important ones for a possible transaction.&lt;/P&gt;

&lt;P&gt;For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="thesource" A="enterEvent"  | stats first(_time) as firstime last(_time)  as lastime  by userId | table firstime lastime userId | eval time_difference=(lastime-firstime)/3600 | where diff&amp;gt;"12" | transaction userId | table _time userId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(obviously I don't have &lt;CODE&gt;_time&lt;/CODE&gt; anymore in my results, but can't I reuse it from the remaining events?)&lt;/P&gt;</description>
      <pubDate>Wed, 16 May 2012 16:30:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-after-stats-table-eval-where/m-p/53210#M12933</guid>
      <dc:creator>Yarsa</dc:creator>
      <dc:date>2012-05-16T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: Transaction after stats/table/eval/where?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Transaction-after-stats-table-eval-where/m-p/53211#M12934</link>
      <description>&lt;P&gt;No, once you've run a command that transforms the results in one way or another, the following commands in the search pipeline will only see the output of that command, so for instance after running &lt;CODE&gt;stats&lt;/CODE&gt; the following commands do not 'see' the original events.&lt;/P&gt;

&lt;P&gt;What you could do though is to put this in a subsearch for getting the userId's that you want to report on first, and then return those to the main search where you get the times for each of those userId's:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="thesource" A="enterEvent" [search source="thesource" A="enterEvent"  | stats first(_time) as firstime last(_time)  as lastime  by userId | table firstime lastime userId | eval time_difference=(lastime-firstime)/3600 | where diff&amp;gt;"12" | fields userId] | table _time userId
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 May 2012 16:46:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Transaction-after-stats-table-eval-where/m-p/53211#M12934</guid>
      <dc:creator>Ayn</dc:creator>
      <dc:date>2012-05-16T16:46:48Z</dc:date>
    </item>
  </channel>
</rss>

