> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/api-reference/databases/mongodb/logs/get-cluster-logs.md).

# Get Cluster Logs

Retrieves MongoDB logs based on the given parameters.

```json
{"openapi":"3.0.3","info":{"title":"IONOS DBaaS MongoDB REST API","version":"1.0.0"},"tags":[{"name":"Logs","description":"How to manage or fetch logs of a database cluster."}],"servers":[{"url":"https://api.ionos.com/databases/mongodb","description":"Production"}],"security":[{"basicAuth":[]},{"tokenAuth":[]}],"components":{"securitySchemes":{"basicAuth":{"type":"http","scheme":"basic","description":"For 'Basic' authentication, take your credentials by first combining the username and password with a colon (``username:password``) and then encoding the resulting string in base64 (``YWxhZGRpbjpvcGVuc2VzYW1l``).\n\n**Example Request Header**\n\n``Authorization: Basic YWxhZGRpbjpvcGVuc2Vzl``\n\nMore details: https://en.wikipedia.org/wiki/Basic_access_authentication\n"},"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Authorization is granted when a valid proof of identity is provided along with an API request for data. This proof of identity is in the form of a JSON web access token, a unique string that identifies a user.\n\n**Example Request Header**\n\n``Authorization: Bearer ACCESS_TOKEN``\n"}},"parameters":{"ClusterIdPath":{"name":"clusterId","in":"path","description":"The unique ID of the cluster.","required":true,"schema":{"type":"string"}}},"schemas":{"ClusterLogs":{"description":"The logs of the MongoDB cluster.","properties":{"instances":{"type":"array","items":{"properties":{"name":{"description":"The name of the MongoDB instance.","type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"time":{"type":"string","format":"date-time"},"message":{"type":"string"}}}}},"type":"object"}}},"type":"object"},"ErrorResponse":{"properties":{"httpStatus":{"type":"integer","description":"The HTTP status code of the operation."},"messages":{"type":"array","items":{"$ref":"#/components/schemas/ErrorMessage"}}},"type":"object"},"ErrorMessage":{"properties":{"errorCode":{"type":"string","description":"Application internal error code.\n"},"message":{"type":"string","description":"A human readable explanation specific to this occurrence of the\nproblem.\n"}},"type":"object"}},"responses":{"ApiError":{"description":"Any erroneous status code: 400 (parse error), 401 (authorization error),\n402 (trial access), 403 (insufficient permissions), 404 (not found),\n405 (unsupported HTTP method), 415 (unsupported content type),\n422 (validation error), 429 (request rate limit exceeded),\n500 (server error), 503 (maintenance)\n","headers":{"Content-Type":{"description":"The content type of the response.","schema":{"type":"string","default":"application/problem+json"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/clusters/{clusterId}/logs":{"get":{"operationId":"clustersLogsGet","summary":"Get Cluster Logs","description":"Retrieves MongoDB logs based on the given parameters.","tags":["Logs"],"parameters":[{"$ref":"#/components/parameters/ClusterIdPath"},{"name":"start","in":"query","description":"The start time for the query in 'RFC3339' format. Must not be more than 30 days ago but, before the end parameter. The default is 30 days ago.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"end","in":"query","description":"The end time for the query in 'RFC3339' format. Must not be greater than now. The default is the current timestamp.","required":false,"schema":{"type":"string","format":"date-time"}},{"name":"direction","in":"query","description":"The direction in which to scan through the logs. The logs are returned in order of the direction.","schema":{"type":"string","default":"BACKWARD","enum":["BACKWARD","FORWARD"]}},{"name":"limit","in":"query","description":"The maximal number of log lines to return. If the maximum limit is reached, then log lines will be cut at the end, depending on which direction MongoDB is scanning the log.","required":false,"schema":{"type":"integer","default":100,"minimum":1,"maximum":5000}}],"responses":{"200":{"description":"Successful operation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClusterLogs"}}}},"default":{"$ref":"#/components/responses/ApiError"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/api-reference/databases/mongodb/logs/get-cluster-logs.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
