Splunk Search

Transaction after stats/table/eval/where?

Yarsa
Path Finder

Hi, is it possible to manipulate the events of a query with a transaction after using stats/table/eval/where?
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.

For example:

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>"12" | transaction userId | table _time userId

(obviously I don't have _time anymore in my results, but can't I reuse it from the remaining events?)

Tags (1)

Ayn
Legend

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 stats the following commands do not 'see' the original events.

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:

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>"12" | fields userId] | table _time userId
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...