Logs-5

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

POST
POST
GET
POST
POST
POST
GET

Create logs count ranges

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/count-ranges
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/count-ranges/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"ranges": [
{
"date_from": "string",
"date_to": "string",
"count": 0
}
],
"interval": "string"
}

Create logs export

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Example request

POST /api/projects/:project_id/logs/export
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/export/

Example response

Status 201

Create logs export

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Example request

POST /api/projects/:project_id/logs/export
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/export/

Example response

Status 201

Retrieve logs has logs

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/logs/has_logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/has_logs/

Example response

Status 200

Retrieve logs has logs

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/logs/has_logs
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/has_logs/

Example response

Status 200

Create logs query

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/query
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/query/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"query": {},
"results": [
{
"uuid": "string",
"timestamp": "string",
"observed_timestamp": "string",
"body": "string",
"severity_text": "string",
"severity_number": 0,
"level": "string",
"trace_id": "string",
"span_id": "string",
"trace_flags": 0,
"attributes": {
"property1": "string",
"property2": "string"
},
"resource_attributes": {
"property1": "string",
"property2": "string"
},
"event_name": "string"
}
],
"hasMore": true,
"nextCursor": "string",
"maxExportableLogs": 0
}

Create logs query

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/query
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/query/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"query": {},
"results": [
{
"uuid": "string",
"timestamp": "string",
"observed_timestamp": "string",
"body": "string",
"severity_text": "string",
"severity_number": 0,
"level": "string",
"trace_id": "string",
"span_id": "string",
"trace_flags": 0,
"attributes": {
"property1": "string",
"property2": "string"
},
"resource_attributes": {
"property1": "string",
"property2": "string"
},
"event_name": "string"
}
],
"hasMore": true,
"nextCursor": "string",
"maxExportableLogs": 0
}

Create logs services

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/services
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/services/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"services": [
{
"service_name": "string",
"log_count": 0,
"error_count": 0,
"error_rate": 0.1
}
],
"sparkline": [
{
"time": "string",
"service_name": "string",
"count": 0
}
]
}

Create logs services

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/services
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/services/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"services": [
{
"service_name": "string",
"log_count": 0,
"error_count": 0,
"error_rate": 0.1
}
],
"sparkline": [
{
"time": "string",
"service_name": "string",
"count": 0
}
]
}

Create logs sparkline

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/sparkline
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/sparkline/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"results": [
{
"time": "string",
"severity": "string",
"service": "string",
"count": 0
}
]
}

Create logs sparkline

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Request parameters

  • query

Response


Example request

POST /api/projects/:project_id/logs/sparkline
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/sparkline/\
-d query=undefined

Example response

Status 200
RESPONSE
{
"results": [
{
"time": "string",
"severity": "string",
"service": "string",
"count": 0
}
]
}

Retrieve logs values

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Query parameters

  • attribute_type
    string
    One of: "log""resource"
  • dateRange
  • filterGroup
    Click to open
    array
    Default:
  • key
    string
  • serviceNames
    array
    Default:
  • value
    string

Response


Example request

GET /api/projects/:project_id/logs/values
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/values/

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "string",
"name": "string"
}
],
"refreshing": true
}

Retrieve logs values

Required API key scopes

logs:read

Path parameters

  • project_id
    string

Query parameters

  • attribute_type
    string
    One of: "log""resource"
  • dateRange
  • filterGroup
    Click to open
    array
    Default:
  • key
    string
  • serviceNames
    array
    Default:
  • value
    string

Response


Example request

GET /api/projects/:project_id/logs/values
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/logs/values/

Example response

Status 200
RESPONSE
{
"results": [
{
"id": "string",
"name": "string"
}
],
"refreshing": true
}

Community questions

Questions about this page? or post a community question.