Logstash filter

I want to capture the events based time period, for example 5 events in 5 mins, which filter can be useful for this scenario.

I tried throttle filter 'period' option but that is not opt for my scenario.