0

I have an event that is triggered when a device starts a process with a unique process id. When the process stops it sends another event with its Timestamp and the same process id. Now I want to calculate the total process time. So subtract the Timestamp from the Startevent from the Timestamp from the Endevent.

I tried multiple ways to accomplish this but they all failed.

Is it possible to save an item from a query to a variable? e.g. select @var = d.ProcessID from table d

or is it possible to make subqueries?? e.g. select d.TimeStamp from table d where d.ProcessID = (select e.ProcessID from table e)

Or if anyone has a different suggestion it would be great to have some input :)

Thanks in advance Greets

H4rl3q1n
  • 25
  • 2

1 Answers1

0

You can use patterns to achieve this. Something like that might work:

select * from pattern [every a=StartEvent -> b=StopEvent(sourceId = a.sourceId, processId = a.processId)]

For more info have a look at the Esper doc.

Georgi
  • 165
  • 1
  • 9