Skip to main content
Version: 26.01

SDK - SDK Logs Start

Endpoint​

/i/sdk_logs/start

Overview​

Starts SDK log gathering for one app user. The next SDK config request of that user carries the directive that switches log gathering on. Logs gathered by an earlier capture for the same user are cleared.

Authentication​

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

Permissions​

Requires sdk Update permission.

Request Parameters​

ParameterTypeRequiredDescription
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired if api_key is not provided.
app_idStringYesApp id.
uidStringYesCountly internal user ID.
levelsStringNoLog levels to capture, any of the letters e (error), w (warning), i (info), d (debug), v (verbose). Defaults to all levels.
batch_sizeIntegerNoLines per upload. Values are limited to 10-500; defaults to 100.

Examples​

Start gathering error and warning logs​

/i/sdk_logs/start?api_key=YOUR_API_KEY&app_id=6991c75b024cb89cdc04efd2&uid=1&levels=ew&batch_size=50

Response​

Success Response​

{
"result": "Success",
"state": {
"s": 1,
"i": "a1b2",
"l": "ewidv",
"b": 100,
"st": 1682328445330,
"by": "admin",
"n": 0
}
}

Response Fields​

FieldTypeDescription
resultStringSuccess when gathering is started.
stateObjectGathering state saved on the user.
state.sNumber1 while gathering is on.
state.iStringCapture ID.
state.lStringLog levels captured.
state.bNumberLines per upload.
state.stNumberStart time in milliseconds.
state.byStringUsername of the member who started the capture.
state.nNumberLines gathered so far.

Error Responses​

  • 400
{
"result": "Missing parameter \"app_id\""
}
  • 400
{
"result": "Error: ..."
}
  • 404
{
"result": "No such app user"
}
  • 500
{
"result": "Error starting SDK log gathering"
}

Behavior​

  • Saves the gathering state on the app user.
  • Deletes log batches stored for the user by an earlier capture.

Impact on Other Data​

  • Updates the user's document in countly.app_users{appId}.
  • Deletes older batches of the user from countly.sdk_logs{appId}.