|
| 1 | +.. _api-download-query-log: |
| 2 | + |
| 3 | +================================== |
| 4 | +Download Query Logs for One {+dl+} |
| 5 | +================================== |
| 6 | + |
| 7 | +.. default-domain:: mongodb |
| 8 | + |
| 9 | +.. meta:: |
| 10 | + :keywords: |data-lake| |
| 11 | + |
| 12 | +.. contents:: On this page |
| 13 | + :local: |
| 14 | + :backlinks: none |
| 15 | + :depth: 2 |
| 16 | + :class: singlecol |
| 17 | + |
| 18 | +.. include:: /includes/fact-projects-groups-synonyms.rst |
| 19 | + |
| 20 | +.. include:: /includes/api-requirements.rst |
| 21 | + |
| 22 | +Use this endpoint to download query logs for a specific {+data-lake+}. |
| 23 | + |
| 24 | +Required Roles |
| 25 | +-------------- |
| 26 | + |
| 27 | +You must have :authrole:`Project Data Access Read Only` or higher role |
| 28 | +to download the query logs for your {+dl+}. |
| 29 | + |
| 30 | +.. include:: /includes/api-base-url.rst |
| 31 | + |
| 32 | +Resource |
| 33 | +-------- |
| 34 | + |
| 35 | +.. code-block:: none |
| 36 | + |
| 37 | + GET /groups/{GROUP-ID}/dataLakes/{NAME}/queryLogs.gz |
| 38 | + |
| 39 | +Request Parameters |
| 40 | +------------------ |
| 41 | + |
| 42 | +Request Path Parameters |
| 43 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 44 | + |
| 45 | +.. list-table:: |
| 46 | + :header-rows: 1 |
| 47 | + :widths: 15 10 75 |
| 48 | + |
| 49 | + * - Path Element |
| 50 | + - Necessity |
| 51 | + - Description |
| 52 | + |
| 53 | + * - ``GROUP-ID`` |
| 54 | + - Required |
| 55 | + - Unique identifier for the :atlas:`project </api/#group-id>` |
| 56 | + that contains the {+dl+} for which you want to download query |
| 57 | + logs. |
| 58 | + |
| 59 | + * - ``NAME`` |
| 60 | + - Required |
| 61 | + - Name of the {+data-lake-short+} for which you want to |
| 62 | + download query logs. |
| 63 | + |
| 64 | + You can use the :doc:`/reference/api/dataLakes-get-all-tenants` |
| 65 | + endpoint to retrieve all {+data-lake+}s associated with the |
| 66 | + project. The ``name`` field in the response of that endpoint |
| 67 | + corresponds to the ``NAME`` parameter here. |
| 68 | + |
| 69 | +Request Query Parameters |
| 70 | +~~~~~~~~~~~~~~~~~~~~~~~~ |
| 71 | + |
| 72 | +.. list-table:: |
| 73 | + :header-rows: 1 |
| 74 | + :widths: 20 10 70 |
| 75 | + |
| 76 | + * - Field |
| 77 | + - Necessity |
| 78 | + - Description |
| 79 | + |
| 80 | + * - ``endDate`` |
| 81 | + - Optional |
| 82 | + - |Epoch-time| that specifies the end point for the range of log |
| 83 | + messages to retrieve. Default is current timestamp. |
| 84 | + |
| 85 | + * - ``startDate`` |
| 86 | + - Optional |
| 87 | + - |Epoch-time| that specifies starting point for the range of |
| 88 | + log messages to retrieve. Default is 4 hours before the |
| 89 | + current timestamp. |
| 90 | + |
| 91 | +Request Body Parameters |
| 92 | +~~~~~~~~~~~~~~~~~~~~~~~ |
| 93 | + |
| 94 | +.. include:: /includes/no-body-parameters.rst |
| 95 | + |
| 96 | +Response |
| 97 | +-------- |
| 98 | + |
| 99 | +The endpoint downloads a compressed log file to your current working |
| 100 | +directory with either the name you specified using the ``--output`` |
| 101 | +option or the default filename in the following format if you specified |
| 102 | +the ``-OJ`` option: |
| 103 | + |
| 104 | +.. code-block:: shell |
| 105 | + :copyable: false |
| 106 | + |
| 107 | + <data-lake-name>_<startdate>_<enddate>_queries.log.gz |
| 108 | + |
| 109 | +Example |
| 110 | +------- |
| 111 | + |
| 112 | +The following example command downloads the logs for queries on the |
| 113 | +{+dl+} to a file named :file:`dataLakeQueryLog.gz`. The command |
| 114 | +downloads the log file to the directory from which you made the |
| 115 | +request. |
| 116 | + |
| 117 | +Request |
| 118 | +~~~~~~~ |
| 119 | + |
| 120 | +.. code-block:: none |
| 121 | + |
| 122 | + curl -u "username:apiKey" --digest \ |
| 123 | + --header "Accept: application/gzip" \ |
| 124 | + --request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/dataLakes/{NAME}/queryLogs.gz" \ |
| 125 | + --output "dataLakeQueryLog.gz" |
| 126 | + |
| 127 | +Response |
| 128 | +~~~~~~~~ |
| 129 | + |
| 130 | +The example ``curl`` command saves the log file to |
| 131 | +:file:`dataLakeQueryLog.gz` in the current working directory and shows |
| 132 | +the following progress output. |
| 133 | + |
| 134 | +.. code-block:: none |
| 135 | + :copyable: false |
| 136 | + |
| 137 | + % Total % Received % Xferd Average Speed Time Time Time Current |
| 138 | + Dload Upload Total Spent Left Speed |
| 139 | + 100 106 100 106 0 0 301 0 --:--:-- --:--:-- --:--:-- 301 |
| 140 | + 100 62883 0 62883 0 0 65915 0 --:--:-- --:--:-- --:--:-- 374k |
0 commit comments