Navigation
This is an upcoming (i.e. in progress) version of the manual.

stopRecordingTraffic

Definition

stopRecordingTraffic

New in version 4.2.

Stops the MongoDB traffic recorder and reports on errors that may have occurred during the recording. The recorder captures all incoming wire protocol traffic to a mongod or mongos instance (and the corresponding responses) and outputs to a specified file.

Warning

The recording file contains unencrypted user traffic information. If possible, limit the retention of this file and store it on an encrypted filesystem volume.

The command has the following form:

db.runCommand( { stopRecordingTraffic: 1 } )

Behavior

When stopRecordingTraffic stops the recorder, it also reports on errors that may have occurred during the recording. For example:

  • If the recorder exceeded the maximum size for the output file.
  • If the recorder exceeded the maximum size of the in-memory buffer for traffic records.
  • If the recorder encountered an I/O error.

To specify the maximum output file size or the maximum in-memory buffer size, see startRecordingTraffic.

To view statistics on the traffic recorder, run db.serverStatus() while the recorder is running to see trafficRecording metrics.

Required Access

When running with access control, the user must have the trafficRecord privilege action on the cluster resource. That is, the user must have a role that grants the following privilege:

{ resource: { cluster: true }, actions: [ "trafficRecord" ] }

The built-in hostManager role provides the required privileges.

Example

The following example stops recording all incoming and outgoing traffic for the mongod/mongos where the command is run:

db.runCommand( { stopRecordingTraffic: 1 } )

Warning

The recording file contains unencrypted user traffic information. If possible, limit the retention of this file.

←   startRecordingTraffic top  →