How to identify if oplog is overriden after reaching its limit

Hi Team,

      Since MongoDB oplog is a capped collection, when it reaches a certain limit, it will start removing the old records to make room for new ones. Is there a way to find that the oplog has been overridden? Is there any command that indicates the oplog had been overridden?

Thanks in advance.

Regards,
Sabareesh

I’m not certain the value of knowing this but you can use rs.printReplicationInfo() to display the current ‘head’ of the Oplog. Once the oplog reached the configured size this value will continue to change.

More important is the oplog window, the total duration of the oplog contents as this is how long a member of the replicaset can be down for before needing an initial sync. 3 days of oplog is a good target, this allows for a member being down for a weekend for example.

https://www.mongodb.com/docs/manual/reference/method/rs.printReplicationInfo/