InfluxDB 2 for event stream processing

I’m already using InfluxDB 1.x for classic timeseries stuff such as server and performance monitoring. I just started playing around with InfluxDB 2 and love exploring all the new possibilities.

I was wondering if InfluxDB 2 is also a good tool for processing event streams. In my perticular case the events happen irregular in time and consist of a category and an action enriched by various metadata. Here’s an example:

  • Door, opened, door_id = 42
  • Light, swiched_on, lamp_id=23, brightness = 255
  • Light, swiched_off, lamp_id=23
  • Door, closed, door_id = 42

This kind of event stream needs to be processed afterwards (but not in realtime) to find defined patterns, e.g. create a “Room used” event if the door was opend for at least 5 minutes and the light was on.

If InfluxDB 2 e.g. with tasks is the right tool for it: What would be a good approach to achieve this?

Many thanks in advance!

Hello @ilmDitsch,
Welcome!
Yes InfluxDB is still a good choice for that type of processing.
You could use window() function and join() to align all of the data together.
Then you could use conditional logic with map() and duration() to describe the conditions youre talking about.

Please let me know if you want more help if you need more than a starting point. If you’re feeling good about it, please share your flux query here for others :slight_smile:

1 Like

Hello @ilmDitsch ,
Just circling back so I don’t lose this post. How’s it going?