For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Create an Ops Manager Server Log Collection Job

When you create an Ops Manager server log collection job, Ops Manager starts background tasks to collect the requested logs from the target servers. Each server collects its logs locally, compresses and encrypts them, and stores the result in the Application Database. Use this endpoint to create a new job.

Base URL: https://{OPSMANAGER-HOST}:{PORT}/api/public/v1.0

POST /admin/omLogCollectionJobs

Requires that the API Key calling this endpoint have the Global Owner role.

This endpoint doesn't use HTTP request path parameters.

The following query parameters are optional:

Name
Type
Necessity
Description
Default

pretty

boolean

Optional

Flag indicating whether the response body is in a prettyprint format.

false

envelope

boolean

Optional

Flag that indicates whether to wrap the response in an envelope.

Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query.

For endpoints that return one result, the response body includes:

  • status: HTTP response code

  • content: Expected response body

false

Name
Type
Necessity
Description

servers

array of strings

Optional

List of serverId values returned by List Active Ops Manager Servers. If you omit this field or pass an empty array, Ops Manager collects logs from every active server.

logTypes

array of strings

Optional

Log types to collect. Each element must be one of the following values:

  • APPLICATION

  • HTTP_ACCESS

  • MIGRATION

  • DAEMON

The DAEMON log type can be collected only from BACKUP_DAEMON servers. The APPLICATION, HTTP_ACCESS, and MIGRATION log types can be collected only from MMS_SERVER servers. If you omit this field or pass an empty array, Ops Manager resolves the log types based on each selected server's type. If you specify a log type that is not valid for a selected server, Ops Manager returns an error.

The DAEMON log type is available only when backup daemon log collection is enabled.

sizeRequestedPerFileBytes

number

Optional

Maximum uncompressed size, in bytes, per log type per server. Must be greater than 0. If you omit this field, Ops Manager auto-allocates the remaining configured storage across the requested servers and log types.

logCollectionFromDate

string

Optional

Start of the time range to collect, in ISO 8601 UTC format. If you set this field, you must also set logCollectionToDate.

logCollectionToDate

string

Optional

End of the time range to collect, in ISO 8601 UTC format. If you set this field, you must also set logCollectionFromDate.

Note

When you combine a size limit and a time range, Ops Manager applies the size limit as a safety cap. If the logs in the time range exceed the size limit, Ops Manager returns the most recent logs up to the size limit and sets sizeLimitHit to true on the affected child jobs. If you omit sizeRequestedPerFileBytes alongside a time range, Ops Manager auto-allocates the remaining configured storage across the requested servers and log types.

Ops Manager rejects a create request that violates one of these rules:

Rule
Error code
HTTP status

sizeRequestedPerFileBytes must be greater than 0.

INVALID_LOG_REQUEST_SIZE

400

logCollectionFromDate and logCollectionToDate must be set together.

OM_LOG_INCOMPLETE_TIME_RANGE

400

logCollectionFromDate must precede logCollectionToDate.

OM_LOG_INVALID_TIME_RANGE

400

logCollectionFromDate must not be in the future.

OM_LOG_TIME_RANGE_IN_FUTURE

400

The time range must not exceed 7 days.

OM_LOG_TIME_RANGE_TOO_LARGE

400

The time range must not start earlier than the maximum log history that the Ops Manager administrator has configured.

OM_LOG_TIME_RANGE_TOO_OLD

400

Each value in servers must identify a registered, active Ops Manager server.

INACTIVE_SERVER or INVALID_SERVER

400

The number of concurrent jobs must not exceed 4.

TOO_MANY_OM_LOG_JOBS

429

The estimated storage must not exceed the storage limit that the Ops Manager administrator has configured for log collection.

OM_LOG_STORAGE_LIMIT_EXCEEDED

413

DAEMON log type requested when backup daemon log collection is disabled.

OM_LOG_DAEMON_DISABLED

400

A log type in logTypes is not valid for one or more servers in servers.

OM_LOG_INVALID_SERVER_LOG_TYPE_COMBINATION

400

Requested per-file size exceeds the remaining storage after allocating to other tasks.

OM_LOG_INSUFFICIENT_STORAGE_PER_FILE

413

Name
Type
Description

id

string

Unique identifier of the new Ops Manager server log collection job.

curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--include \
--request POST \
"https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/omLogCollectionJobs?pretty=true" \
--data '
{
"servers": [
"om-server-1.example.com",
"om-server-2.example.com"
],
"logTypes": ["APPLICATION", "HTTP_ACCESS"],
"sizeRequestedPerFileBytes": 5242880,
"logCollectionFromDate": "2026-04-13T10:00:00Z",
"logCollectionToDate": "2026-04-14T10:00:00Z"
}'
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--include \
--request POST \
"https://<OpsManagerHost>:<Port>/api/public/v1.0/admin/omLogCollectionJobs?pretty=true" \
--data '
{
"servers": [
"om-server-1.example.com",
"daemon-host-1.example.com"
],
"logTypes": ["APPLICATION", "DAEMON"],
"sizeRequestedPerFileBytes": 5242880
}'
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=ISO-8859-1
Date: {dateInUnixFormat}
WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false
Content-Length: {requestLengthInBytes}
Connection: keep-alive
HTTP/1.1 201 Created
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
X-MongoDB-Service-Version: gitHash={gitHash}; versionString={ApplicationVersion}
{ "id": "675a1234567890abcdef1234" }