:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"query": {
"description": "The logs query to execute.",
"properties": {
"after": {
"description": "Pagination cursor from previous response.",
"type": "string"
},
"customColumns": {
"default": [],
"description": "Custom column expressions evaluated per log row. Each entry is either a source-prefixed shorthand (`attributes.<key>`, `resource_attributes.<key>`, `body.<json.path>`) or a scalar HogQL expression (`upper(level)`, `coalesce(attributes['a'], attributes['b'])`). Aggregations and subqueries are rejected. Values come back on each result row keyed by the aliases echoed in the response `columns` field.",
"items": {
"type": "string"
},
"type": "array"
},
"dateRange": {
"description": "Date range for the query. Defaults to last hour.",
"properties": {
"date_from": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Start of the date range. Accepts ISO 8601 timestamps or relative formats: -7d, -1h, -1mStart, etc."
},
"date_to": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "End of the date range. Same format as date_from. Omit or null for \"now\"."
}
},
"type": "object"
},
"excludeAttributes": {
"default": false,
"description": "Omit the per-log attributes and resource_attributes maps from results to keep payloads compact. Defaults to false.",
"type": "boolean"
},
"filterGroup": {
"anyOf": [
{
"items": {
"properties": {
"key": {
"description": "Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").",
"type": "string"
},
"operator": {
"description": "Comparison operator.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `starts_with` - starts_with\n* `not_starts_with` - not_starts_with\n* `ends_with` - ends_with\n* `not_ends_with` - not_ends_with\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `lt` - lt\n* `is_date_exact` - is_date_exact\n* `is_date_before` - is_date_before\n* `is_date_after` - is_date_after\n* `is_set` - is_set\n* `is_not_set` - is_not_set",
"enum": [
"exact",
"is_not",
"icontains",
"not_icontains",
"starts_with",
"not_starts_with",
"ends_with",
"not_ends_with",
"regex",
"not_regex",
"gt",
"lt",
"is_date_exact",
"is_date_before",
"is_date_after",
"is_set",
"is_not_set"
],
"type": "string"
},
"type": {
"description": "\"log\" filters the log body/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n* `log` - log\n* `log_attribute` - log_attribute\n* `log_resource_attribute` - log_resource_attribute",
"enum": ["log", "log_attribute", "log_resource_attribute"],
"type": "string"
},
"value": {
"description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
}
},
"required": ["key", "type", "operator"],
"type": "object"
},
"type": "array"
},
{
"properties": {
"type": {
"description": "How to combine the groups in `values`.\n\n* `AND` - AND\n* `OR` - OR",
"enum": ["AND", "OR"],
"type": "string"
},
"values": {
"description": "Groups of property filters.",
"items": {
"properties": {
"type": {
"description": "How to combine the filters in `values`.\n\n* `AND` - AND\n* `OR` - OR",
"enum": ["AND", "OR"],
"type": "string"
},
"values": {
"description": "Property filters in this group.",
"items": {
"properties": {
"key": {
"description": "Attribute key. For type \"log\", use \"message\" for the body text, or a log column: \"pattern\" and \"pattern_version\" (the patterns pivot), \"severity_level\", \"service_name\", \"trace_id\", \"span_id\". For \"log_attribute\"/\"log_resource_attribute\", use the attribute key (e.g. \"k8s.container.name\").",
"type": "string"
},
"operator": {
"description": "Comparison operator.\n\n* `exact` - exact\n* `is_not` - is_not\n* `icontains` - icontains\n* `not_icontains` - not_icontains\n* `starts_with` - starts_with\n* `not_starts_with` - not_starts_with\n* `ends_with` - ends_with\n* `not_ends_with` - not_ends_with\n* `regex` - regex\n* `not_regex` - not_regex\n* `gt` - gt\n* `lt` - lt\n* `is_date_exact` - is_date_exact\n* `is_date_before` - is_date_before\n* `is_date_after` - is_date_after\n* `is_set` - is_set\n* `is_not_set` - is_not_set",
"enum": [
"exact",
"is_not",
"icontains",
"not_icontains",
"starts_with",
"not_starts_with",
"ends_with",
"not_ends_with",
"regex",
"not_regex",
"gt",
"lt",
"is_date_exact",
"is_date_before",
"is_date_after",
"is_set",
"is_not_set"
],
"type": "string"
},
"type": {
"description": "\"log\" filters the log body/message. \"log_attribute\" filters log-level attributes. \"log_resource_attribute\" filters resource-level attributes.\n\n* `log` - log\n* `log_attribute` - log_attribute\n* `log_resource_attribute` - log_resource_attribute",
"enum": ["log", "log_attribute", "log_resource_attribute"],
"type": "string"
},
"value": {
"description": "Value to compare against. String, number, or array of strings. Omit for is_set/is_not_set operators."
}
},
"required": ["key", "type", "operator"],
"type": "object"
},
"type": "array"
}
},
"required": ["type", "values"],
"type": "object"
},
"type": "array"
}
},
"required": ["type", "values"],
"type": "object"
}
],
"description": "Property filters for the query. Pass a list of filters, which are all combined with AND, or a filter group object with nested AND/OR groups."
},
"limit": {
"default": 100,
"description": "Max results. Values above 2000 are capped at 2000.",
"minimum": 1,
"type": "number"
},
"orderBy": {
"description": "Order results by timestamp.\n\n* `latest` - latest\n* `earliest` - earliest",
"enum": ["latest", "earliest"],
"type": "string"
},
"personId": {
"description": "Scope results to one person (UUID or numeric ID). Expanded server-side to the person's distinct IDs and matched against the team's configured distinct-id log attribute keys.",
"type": "string"
},
"searchTerm": {
"description": "Full-text search term to filter log bodies.",
"type": "string"
},
"serviceNames": {
"default": [],
"description": "Filter by service names.",
"items": {
"type": "string"
},
"type": "array"
},
"sessionId": {
"description": "Scope results to one session ID. Matched server-side against the team's configured session-id log attribute keys plus the built-in conventions, in both log attributes and resource attributes.",
"type": "string"
},
"severityLevels": {
"default": [],
"description": "Filter by log severity levels.",
"items": {
"description": "* `trace` - trace\n* `debug` - debug\n* `info` - info\n* `warn` - warn\n* `error` - error\n* `fatal` - fatal",
"enum": ["trace", "debug", "info", "warn", "error", "fatal"],
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
},
"required": ["query"],
"type": "object"
}