Navigation

Logs

Retrieves a compressed (.gz) log file that contains a range of log messages for a particular host in an Atlas cluster.

Note

This feature is not available for M0 (Free Tier), M2, and M5 clusters. For more information, see Atlas M0 (Free Tier), M2, and M5 Limitations.

Important

You must be an Owner of the group that the cluster belongs to in order to retrieve the log.

Base URL: https://cloud.mongodb.com/

Syntax

GET /api/atlas/v1.0/groups/{GROUP-ID}/clusters/{HOSTNAME}/logs/mongodb.gz

Request Path Parameters

Parameter Required/Optional Description
GROUP-ID Required Group identifier.
HOSTNAME Required Name of the host.

Request Query Parameters

Field Required/Optional Description
startDate Optional.

Timestamp that specifies starting point for the range of log messages to retrieve.

Default is 24 hours prior to the current timestamp.

endDate Optional. Timestamp that specifies the end point for the range of log messages to retrieve. Default is current timestamp.

Request Body Parameters

This endpoint does not use HTTP request body parameters.

Response Elements

The response includes the following elements:

Field Description
appName MongoDB Cloud
build The SHA that corresponds to the GitHub commit for the Atlas.
links Array of links to related API resources. For more information on links, see Linking.
throttling The field is obsolete and has the value false.

Example

Example Request

curl -X GET -u "username:apiKey" --digest -o downloadedLog.gz \
"https://cloud.mongodb.com/api/atlas/v1.0/groups/99999962187d9d67ca76b85f8/clusters/mycluster-shard-00-00-mptda.mongodb.net/logs/mongodb.gz?startDate=1500249600&endDate=1500422400"

Example Response

The request should download the log file and save to downloadedLog.gz.