Navigation

Download Query Logs for One Data Lake

On this page

  • Required Roles
  • Base URL
  • Resource
  • Request Parameters
  • Request Path Parameters
  • Request Query Parameters
  • Request Body Parameters
  • Response
  • Example
  • Request
  • Response
Note

Groups and projects are synonymous terms. Your {GROUP-ID} is the same as your project ID. For existing groups, your group/project ID remains the same. The resource and corresponding endpoints use the term groups.

The Atlas API uses HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

For complete documentation on configuring API access for an Atlas project, see Configure Atlas API Access.

Use this endpoint to download query logs for a specific Atlas Data Lake.

You must have Project Data Access Read Only or higher role to download the query logs for your Data Lake.

https://cloud.mongodb.com/api/atlas/v1.0
GET /groups/{GROUP-ID}/dataLakes/{NAME}/queryLogs.gz
Path Element
Necessity
Description
GROUP-ID
Required
Unique identifier for the project that contains the Data Lake for which you want to download query logs.
NAME
Required

Name of the Data Lake for which you want to download query logs.

You can use the Get All Data Lakes endpoint to retrieve all Atlas Data Lakes associated with the project. The name field in the response of that endpoint corresponds to the NAME parameter here.

Field
Necessity
Description
endDate
Optional
Timestamp in the number of seconds that have elapsed since the UNIX epoch that specifies the end point for the range of log messages to retrieve. Default is current timestamp.
startDate
Optional
Timestamp in the number of seconds that have elapsed since the UNIX epoch that specifies starting point for the range of log messages to retrieve. Default is 4 hours before the current timestamp.

This endpoint does not use HTTP request body parameters.

The endpoint downloads a compressed log file to your current working directory with either the name you specified using the --output option or the default filename in the following format if you specified the -OJ option:

<data-lake-name>_<startdate>_<enddate>_queries.log.gz

The following example command downloads the logs for queries on the Data Lake to a file named dataLakeQueryLog.gz. The command downloads the log file to the directory from which you made the request.

curl -u "username:apiKey" --digest \
--header "Accept: application/gzip" \
--request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/dataLakes/{NAME}/queryLogs.gz" \
--output "dataLakeQueryLog.gz"

The example curl command saves the log file to dataLakeQueryLog.gz in the current working directory and shows the following progress output.

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 106 100 106 0 0 301 0 --:--:-- --:--:-- --:--:-- 301
100 62883 0 62883 0 0 65915 0 --:--:-- --:--:-- --:--:-- 374k
Give Feedback

On this page

  • Required Roles
  • Base URL
  • Resource
  • Request Parameters
  • Request Path Parameters
  • Request Query Parameters
  • Request Body Parameters
  • Response
  • Example
  • Request
  • Response