Oplog Access¶
The oplog (operations log) is a special capped collection that keeps a rolling record of all operations that modify the data stored in your databases.
Add a User with Oplog Access¶
To access the oplog, a database user must have read access on
the local
database. To create a user with read access on local
:
- In the Security section of the left navigation, click Database Access.
- Click the Database Users tab.
- Click Add New Database User and enter a
user name such as
oploguser
. - Click Add Default Privileges and select the
read
role and thelocal
database. This restricts the user to read operations on thelocal
database. - Enter a password and click Add User.
Access the Oplog¶
- Connect to your cluster with the
mongo
shell, using the credentials of the new database user with access to thelocal
database. Switch to the
local
database.> use local The oplog collection is named
oplog.rs
. Database write operations are recorded in date order, with a timestamp field and a wall clock field.The timestamp field contains an integer with seconds since epoch.
Note
- To increase the size of an oplog for a cluster, see Set Oplog Size.
- You cannot use the MongoDB command replSetResizeOplog to resize the oplog.
Give Feedback