After some suggestion in the comments, I came up with something that does the job, maybe someone has a more elegant solution?
import monix.reactive.Observable
import monix.execution.Scheduler.Implicits.global
import java.time.ZonedDateTime
import scala.concurrent.duration.DurationInt
import scala.language.postfixOps
val events = Observable.range(0, 100).delayOnNext(1 second)
val timeWindow = 5 seconds
val timestamps = events.map(_ => ZonedDateTime.now())
events.zip(timestamps).scan(Seq[(Long, ZonedDateTime)]())((acc, event) => {
(acc :+ event).filter(_._2.isAfter(ZonedDateTime.now().minusSeconds(timeWindow.toSeconds)))
}).map(_.map(_._1)).foreach(println)