Skip to main content

Error Logs - Logs Read

Endpoint

/o/errorlogs

Overview

Returns discovered Countly log file contents as a key-value map (log_key -> log_text).

Authentication

Countly API supports three authentication methods:

  1. API Key (parameter): api_key=YOUR_API_KEY
  2. Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  3. Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Required permission: Global Admin.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or use auth_token)API key for authentication.
auth_tokenStringNoAuth token as query parameter or countly-token header.
bytesNumberNoIf greater than 0, returns only the last N bytes (aligned to first full line in the read chunk) from each log.

Response

Success Response

{
"api": "2026-02-17 10:00:00 [INFO] API started\n...",
"dashboard": "2026-02-17 10:00:01 [INFO] Dashboard started\n..."
}

Response Fields

FieldTypeDescription
(root)ObjectRaw map of discovered log keys to log text content.
{log_key}StringLog content for that key (full or tail text based on bytes).

Error Responses

  • 400
{
"result": "Missing parameter \"api_key\" or \"auth_token\""
}
  • 400
{
"result": "Token not valid"
}
  • 401
{
"result": "User does not exist"
}
  • 401
{
"result": "User does not have right"
}
  • 401
{
"result": "User is locked"
}
  • 401
{
"result": "Token is invalid"
}

Behavior/Processing

  • Validates global-admin permissions.
  • Discovers log files matching countly-*.log in server log directory.
  • Reads each log file (full content or tail bytes).
  • Returns discovered logs as one object map.
  • Read failures per file return empty string for that file key.

Database Collections

This endpoint does not read or write database collections.

Examples

Read all logs (full)

/o/errorlogs?api_key=YOUR_API_KEY

Read last 2000 bytes from each log

/o/errorlogs?api_key=YOUR_API_KEY&bytes=2000

Limitations

  • Output size can be large when bytes is omitted.
  • Individual file read failures do not fail the whole response; affected log values are empty strings.

Last Updated

2026-02-17