Logs-7

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

Endpoints

POST
POST
GET

Create logs services

Also available via the PostHog MCP server:

  • logs-services-createList services with stats

Required API key scopes

logs:read

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,
"volume_share_pct": 0.1,
"severity_breakdown": {
"debug": 0,
"info": 0,
"warn": 0,
"error": 0
},
"active_rules": [
{
"rule_id": "728c1541-d6d1-4290-9a53-cdf01dd32d60",
"rule_name": "string",
"summary_string": "string"
}
]
}
],
"sparkline": [
{
"time": "string",
"service_name": "string",
"count": 0
}
],
"summary": {
"top_services_count": 0,
"top_services_volume_share_pct": 0.1
}
}

Create logs sparkline

Required API key scopes

logs:read

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,
"bytes_uncompressed": 0
}
]
}

Create logs sparkline

Required API key scopes

logs:read

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,
"bytes_uncompressed": 0
}
]
}

Retrieve logs values

Required API key scopes

logs:read

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

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.