Logs
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
PATCH | |
DELETE | |
POST | |
POST | |
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
POST | |
POST | |
POST | |
POST | |
GET | |
GET | |
POST | |
GET | |
PATCH |
Update logs retention rules
Retention rules for one record kind.
TracingRetentionRuleViewSet reuses this for span rules, which live in their own model. It
swaps the queryset, the serializer and team_rules, so every read and write here goes through
team_rules rather than naming a model.
Required API key scopes
logs:writePath parameters
- idstring
Request parameters
- namestring
- enabledbooleanDefault:
false - priorityinteger | null
- config
Response
Example request
PATCH /api /projects /:project_id /logs /retention_rules /:idExample response
Status 200
Delete logs retention rules
Retention rules for one record kind.
TracingRetentionRuleViewSet reuses this for span rules, which live in their own model. It
swaps the queryset, the serializer and team_rules, so every read and write here goes through
team_rules rather than naming a model.
Required API key scopes
logs:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /logs /retention_rules /:idExample response
Status 204 No response body
Create logs retention rules reorder
Atomically reassign priorities so the given ID order maps to ascending priorities (0..n-1).
Query parameters
- limitinteger
- offsetinteger
Request parameters
- ordered_idsarray
Response
Example request
POST /api /projects /:project_id /logs /retention_rules /reorderExample response
Status 200
Create logs retention rules suggest name
Suggest a human-readable name for a retention rule from its retention tier and filter group. Used by the create form as an auto-suggest; nothing is persisted. Returns an empty name when a suggestion can't be generated.
Request parameters
- retention_daysinteger
- filter_group
Response
Example request
POST /api /projects /:project_id /logs /retention_rules /suggest_nameExample response
Status 200
List all logs sampling rules
Required API key scopes
logs:readQuery parameters
- limitinteger
- offsetinteger
- sourcestringDefault:
logsOne of:"logs""spans"
Response
Example request
GET /api /projects /:project_id /logs /sampling_rulesExample response
Status 200
Create logs sampling rules
Required API key scopes
logs:writeRequest parameters
- namestring
- enabledbooleanDefault:
false - priorityinteger | null
- rule_type
- scope_servicestring | null
- scope_path_patternstring | null
- scope_attribute_filtersarray
- config
- source
Response
Example request
POST /api /projects /:project_id /logs /sampling_rulesExample response
Status 201
Retrieve logs sampling rules
Required API key scopes
logs:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /logs /sampling_rules /:idExample response
Status 200
Update logs sampling rules
Required API key scopes
logs:writePath parameters
- idstring
Request parameters
- namestring
- enabledbooleanDefault:
false - priorityinteger | null
- rule_type
- scope_servicestring | null
- scope_path_patternstring | null
- scope_attribute_filtersarray
- config
- source
Response
Example request
PATCH /api /projects /:project_id /logs /sampling_rules /:idExample response
Status 200
Delete logs sampling rules
Required API key scopes
logs:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /logs /sampling_rules /:idExample response
Status 204 No response body
Create logs sampling rules simulate
Dry-run estimate for how much volume this rule would remove (placeholder response until CH-backed simulation is wired).
Path parameters
- idstring
Response
Example request
POST /api /projects /:project_id /logs /sampling_rules /:id /simulateExample response
Status 200
Create logs sampling rules reorder
Atomically reassign priorities so the given ID order maps to ascending priorities (0..n-1). Log and span rules have separate orders; the source query parameter picks which one.
Query parameters
- limitinteger
- offsetinteger
- sourcestringDefault:
logsOne of:"logs""spans"
Request parameters
- ordered_idsarray
Response
Example request
POST /api /projects /:project_id /logs /sampling_rules /reorderExample response
Status 200
Create logs services
Also available via the PostHog MCP server:
logs-services-create— List services with health status
Required API key scopes
logs:readRequest parameters
- query
- baselineDateRange
Response
Example request
POST /api /projects /:project_id /logs /servicesExample response
Status 200
Create logs sparkline
Required API key scopes
logs:readRequest parameters
- query
Example request
POST /api /projects /:project_id /logs /sparklineExample response
Status 200
Retrieve logs values
Required API key scopes
logs:readQuery parameters
- attribute_typestringOne of:
"log""resource" - dateRange
- filterGrouparrayDefault:
- keystring
- serviceNamesarrayDefault:
- valuestring
Response
Example request
GET /api /projects /:project_id /logs /valuesExample response
Status 200
List all logs views
Required API key scopes
logs:readQuery parameters
- limitinteger
- offsetinteger
Response
Example request
GET /api /projects /:project_id /logs /viewsExample response
Status 200
Create logs views
Required API key scopes
logs:writeRequest parameters
- namestring
- filtersobject
- columnsarray | null
- pinnedboolean
Response
Example request
POST /api /projects /:project_id /logs /viewsExample response
Status 201
Retrieve logs views
Required API key scopes
logs:readPath parameters
- short_idstring
Response
Example request
GET /api /projects /:project_id /logs /views /:short_idExample response
Status 200
Update logs views
Required API key scopes
logs:writePath parameters
- short_idstring
Request parameters
- namestring
- filtersobject
- columnsarray | null
- pinnedboolean
Response
Example request
PATCH /api /projects /:project_id /logs /views /:short_id




