Skip to main content
Version: 26.01

SDK - SDK Logs Read

Endpoint​

/o?method=sdk_logs

Overview​

Returns the SDK logs gathered for one app user during the current capture, newest batch first, together with the capture state and line counts per log level. Start a capture with SDK - SDK Logs Start.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires sdk Read permission.

Request Parameters​

ParameterTypeRequiredDescription
methodStringYesMust be sdk_logs.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.
app_idStringYesApp id.
uidStringYesCountly internal user ID.
limitIntegerNoBatches per page. Values are limited to 1-200; defaults to 50.
skipIntegerNoBatches to skip. Defaults to 0.

Examples​

Read the first 50 log batches of a user​

/o?method=sdk_logs&api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&uid=1

Read the next page​

/o?method=sdk_logs&api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&uid=1&limit=50&skip=50

Response​

Success Response​

{
"state": {
"s": 1,
"i": "a1b2",
"l": "ewidv",
"b": 100,
"st": 1682328445330,
"by": "admin",
"n": 12
},
"batches": [],
"total": 1,
"lines": 12,
"counts": {
"e": 1,
"w": 2,
"i": 9,
"d": 0,
"v": 0
}
}

When the user has no capture, state is null, batches is empty and all counts are 0.

Response Fields​

FieldTypeDescription
stateObjectGathering state saved on the user, or null. Fields are the same as in SDK - SDK Logs Start.
batchesArrayLog batches of the current capture, newest first.
totalNumberNumber of batches in the capture.
linesNumberNumber of log lines in the capture.
countsObjectLog lines per level: e (error), w (warning), i (info), d (debug), v (verbose).

Error Responses​

  • 400
{
"result": "Missing parameter \"app_id\""
}
  • 400
{
"result": "Error: ..."
}
  • 500
{
"result": "Error fetching SDK logs"
}

Behavior​

  • Reads the capture state from the app user, then the batches that belong to that capture.
  • limit and skip page through batches only; total, lines and counts cover the whole capture.