Limit number of events

Is there a way, I can limit the number of events in logstash. e.g. I want filtered 5 events in every one second

It depends. Do you want to limit the actual processing rate, or process 5 events and drop the rest?

If it's the latter, you can check the throttle filter for that.