PostHog Logs API

The logs API from PostHog — 43 operation(s) for logs.

GitHub OpenAPI
Business capability
Observability Management BC-4220.20

Operations 63

Each operation below carries the questions people ask an LLM about it and the instructions they give an agent to run it. Generated by API Evangelist overlay

GET /api/environments/{environment_id}/logs/alerts/ List log alerts in an environment · Environments logs alerts list #
Ask an LLM
“What log alerts are configured in my environment?”
“Can I page through the log alerts for an environment?”
Tell an agent
List log alerts in environment {environment_id}.
Show {limit} log alerts from environment {environment_id}.
POST /api/environments/{environment_id}/logs/alerts/ Create a log alert · Environments logs alerts create #
Ask an LLM
“How do I get notified when log errors cross a threshold?”
“Can I set a log alert to fire only if the count is below a threshold?”
Tell an agent
Create a log alert in environment {environment_id} that fires every {check_interval_minutes} minutes.
Create a log alert in {environment_id} with filters {filters}, firing when {threshold_count} logs are seen in {window_minutes} minutes.
GET /api/environments/{environment_id}/logs/alerts/{id}/ Get a log alert · Environments logs alerts retrieve #
Ask an LLM
“What filters and thresholds does a specific log alert use?”
“Can I look up one log alert by its ID?”
Tell an agent
Get log alert {id} in environment {environment_id}.
Show the filters and state of log alert {id} in {environment_id}.
PUT /api/environments/{environment_id}/logs/alerts/{id}/ Replace a log alert · Environments logs alerts update #
Ask an LLM
“How do I change the filters on an existing log alert?”
“Can I replace a log alert's entire configuration at once?”
Tell an agent
Replace log alert {id} in environment {environment_id} with filters {filters} and check interval {check_interval_minutes}.
Overwrite the whole log alert {id} in {environment_id}.
PATCH /api/environments/{environment_id}/logs/alerts/{id}/ Update fields of a log alert · Environments logs alerts partial update #
Ask an LLM
“Can I turn off a log alert without deleting it?”
“How do I change only the destination of an existing log alert?”
Tell an agent
Disable log alert {id} in environment {environment_id}.
Set the destination of log alert {id} in {environment_id} to {destination_types}.
DELETE /api/environments/{environment_id}/logs/alerts/{id}/ Delete a log alert · Environments logs alerts destroy #
Ask an LLM
“How do I delete a log alert I no longer need?”
“Can I remove a log alert by its ID?”
Tell an agent destructive · confirm first
Delete log alert {id} from environment {environment_id}.
Remove the log alert {id} in {environment_id}.
POST /api/environments/{environment_id}/logs/alerts/{id}/destinations/ Add a notification destination to a log alert · Environments logs alerts destinations create #
Ask an LLM
“How do I get a log alert's notifications sent to Slack?”
“Can I add a webhook destination to an existing log alert?”
Tell an agent
Add a {type} destination to log alert {id} in environment {environment_id}.
Send log alert {id} notifications from {environment_id} to Slack channel {slack_channel_id}.
POST /api/environments/{environment_id}/logs/alerts/{id}/destinations/delete/ Delete a log alert's notification destination · Environments logs alerts destinations delete create #
Ask an LLM
“How do I stop a log alert from sending notifications to one destination?”
“Can I delete a HogFunction group for a log alert's destination?”
Tell an agent destructive · confirm first
Delete HogFunction group {hog_function_ids} from log alert {id} in {environment_id}.
Remove the destination group {hog_function_ids} on log alert {id} in {environment_id}.
GET /api/environments/{environment_id}/logs/alerts/{id}/events/ List an alert's event history · Environments logs alerts events list #
Ask an LLM
“What has happened to a log alert recently, like snoozes or resets?”
“Can I see the event history of a log alert?”
Tell an agent
List events for log alert {id} in environment {environment_id}.
Show the last {limit} events of log alert {id} in {environment_id}.
POST /api/environments/{environment_id}/logs/alerts/{id}/reset/ Reset a broken log alert · Environments logs alerts reset create #
Ask an LLM
“My log alert has a broken state with consecutive failures, how do I reset it?”
“Can I clear a log alert's failure counter and recheck it immediately?”
Tell an agent
Reset log alert {id} in environment {environment_id}.
Clear the consecutive failures on log alert {id} in {environment_id} and recheck now.
POST /api/environments/{environment_id}/logs/alerts/simulate/ Simulate a logs alert on an environment · Environments logs alerts simulate create #
Ask an LLM
“Can I test a logs alert against historical data on an environment?”
“How do I see what an environment-level log alert simulation would return?”
Tell an agent
Simulate a logs alert on env {env} for {filters} over {date_from} with threshold {threshold_count} {operator} {window}.
Dry-run an environment log alert with {threshold_count} {operator} {window} for filters {filters}, from {date_from}.
GET /api/environments/{environment_id}/logs/attributes/ List log attributes · Environments logs attributes retrieve #
Ask an LLM
“Which log attributes are available in my environment?”
“Can I search log attributes by name or service?”
Tell an agent
List log attributes in environment {environment_id}.
Find log attributes in {environment_id} matching {search}.
POST /api/environments/{environment_id}/logs/count/ Count logs matching a query · Environments logs count create #
Ask an LLM
“How many logs match a given query in an environment?”
“Can I get a total log count for a time range?”
Tell an agent
Count logs in environment {environment_id} matching {query}.
Get the total number of logs in {environment_id} that match {query}.
POST /api/environments/{environment_id}/logs/count-ranges/ Count logs in time buckets · Environments logs count ranges create #
Ask an LLM
“Can I see how log volume changed over time in an environment?”
“How do I get a time-series count of logs for a query?”
Tell an agent
Count logs in {environment_id} in time buckets for {query}.
Bucket the log count for {query} in environment {environment_id}.
POST /api/environments/{environment_id}/logs/export/ Export logs · Environments logs export create #
Ask an LLM
“How do I export all logs from an environment?”
“Can I start a log export job for an environment?”
Tell an agent
Export all logs from environment {environment_id}.
Start a log export job for {environment_id}.
GET /api/environments/{environment_id}/logs/has_logs/ Check whether an environment has logs · Environments logs has logs retrieve #
Ask an LLM
“Does my environment have any logs ingested?”
“How do I confirm logs are flowing into an environment?”
Tell an agent
Check whether environment {environment_id} has logs.
Tell me if logs exist in {environment_id}.
POST /api/environments/{environment_id}/logs/query/ Query logs · Environments logs query create #
Ask an LLM
“How do I search logs in an environment?”
“Can I run a raw logs query against an environment?”
Tell an agent
Query logs in environment {environment_id} with {query}.
Run the raw logs query {query} in {environment_id}.
GET /api/environments/{environment_id}/logs/sampling_rules/ List log sampling rules · Environments logs sampling rules list #
Ask an LLM
“Which log sampling rules are configured in an environment?”
“Can I page through log sampling rules?”
Tell an agent
List log sampling rules in environment {environment_id}.
Show {limit} log sampling rules from {environment_id}.
POST /api/environments/{environment_id}/logs/sampling_rules/ Create a log sampling rule · Environments logs sampling rules create #
Ask an LLM
“How do I drop logs from a specific path to save storage?”
“Can I sample logs by severity in an environment?”
Tell an agent
Create a log sampling rule {id} in environment {environment_id} with config {config}.
Add a log sampling rule {id} in {environment_id} that drops logs matching {scope_path_pattern}.
GET /api/environments/{environment_id}/logs/sampling_rules/{id}/ Get a log sampling rule · Environments logs sampling rules retrieve #
Ask an LLM
“What does a specific log sampling rule do?”
“Can I look up one log sampling rule by its ID?”
Tell an agent
Get log sampling rule {id} in environment {environment_id}.
Show the filters of log sampling rule {id} in {environment_id}.
PUT /api/environments/{environment_id}/logs/sampling_rules/{id}/ Replace a log sampling rule · Environments logs sampling rules update #
Ask an LLM
“How do I replace a log sampling rule's config and version?”
“Can I change a sampling rule's priority and scope?”
Tell an agent
Replace log sampling rule {id} in environment {environment_id} with name {name}, type {rule_type}, config {config} and version {version}.
Update sampling rule {id} in {environment_id} to priority {priority}.
PATCH /api/environments/{environment_id}/logs/sampling_rules/{id}/ Change a log sampling rule · Environments logs sampling rules partial update #
Ask an LLM
“How do I disable a log sampling rule without deleting it?”
“Can I change only the config of an existing log sampling rule?”
Tell an agent
Disable log sampling rule {id} in environment {environment_id}.
Change the config of log sampling rule {id} in {environment_id} to {config}.
DELETE /api/environments/{environment_id}/logs/sampling_rules/{id}/ Delete a log sampling rule · Environments logs sampling rules destroy #
Ask an LLM
“How do I delete a log sampling rule?”
“Can I remove a log exclusion rule by its ID?”
Tell an agent destructive · confirm first
Delete log sampling rule {id} from environment {environment_id}.
Remove log exclusion rule {id} in {environment_id}.
POST /api/environments/{environment_id}/logs/sampling_rules/{id}/simulate/ Estimate how much a log sampling rule would remove · Environments logs sampling rules simulate create #
Ask an LLM
“How much log volume would a sampling rule remove?”
“Can I dry-run a log sampling rule before saving it?”
Tell an agent
Simulate log sampling rule {id} in environment {environment_id}.
Dry-run estimate for how much volume rule {id} would remove in {environment_id}.
POST /api/environments/{environment_id}/logs/sampling_rules/reorder/ Reorder log sampling rules on an environment · Environments logs sampling rules reorder create #
Ask an LLM
“Can I change the priority order of sampling rules on an environment?”
“What happens to sampling rule priorities when I reorder them on an environment?”
Tell an agent
Reorder env {env}'s log sampling rules to priorities {ids}.
Set the environment sampling rule priority order to {ids} on env {env}.
POST /api/environments/{environment_id}/logs/services/ Find log services in an environment · Environments logs services create #
Ask an LLM
“Which services are sending logs in an environment?”
“Can I list log services for a project environment?”
Tell an agent
Find log services in environment {environment_id} matching {query}.
List services sending logs in {environment_id}.
POST /api/environments/{environment_id}/logs/sparkline/ Get a log sparkline for an environment · Environments logs sparkline create #
Ask an LLM
“Can I get a log volume sparkline for a project environment?”
“What does the log volume trend look like in an environment?”
Tell an agent
Get a log sparkline for environment {environment_id} with query {query}.
Show the log volume trend for {environment_id}.
GET /api/environments/{environment_id}/logs/values/ Get log values for an attribute · Environments logs values retrieve #
Ask an LLM
“What values appear for a log attribute in an environment?”
“Can I filter log values by service name?”
Tell an agent
Get values for log attribute {key} in environment {environment_id}.
Show values of {key} in {environment_id} for services {serviceNames}.
POST /api/environments/{project_id}/logs/explainLogWithAI/ Explain a log entry with AI · Logs explain log with AI create #
Ask an LLM
“Can AI explain a specific log entry?”
“How do I get an AI explanation of a log by its UUID?”
Tell an agent
Explain log {uuid} at {timestamp} in project {project_id} with AI.
Get an AI explanation of log {uuid} in {project_id}.
GET /api/environments/{project_id}/logs/views/ List log views in a project · Logs views list #
Ask an LLM
“What log views exist in my project?”
“Can I list pinned log views?”
Tell an agent
List log views in project {project_id}.
Show the log views in {project_id} pinned to the sidebar.
POST /api/environments/{project_id}/logs/views/ Create a log view · Logs views create #
Ask an LLM
“How do I save a log search as a view?”
“Can I create a log view with filters and a name?”
Tell an agent
Create log view {name} in project {project_id} with filters {filters}.
Save a log search as view {name} in {project_id}.
GET /api/environments/{project_id}/logs/views/{short_id}/ Get a log view · Logs views retrieve #
Ask an LLM
“How do I open a saved log view?”
“Can I fetch one log view by its short ID?”
Tell an agent
Get log view {short_id} in project {project_id}.
Open saved log view {short_id} in {project_id}.
PUT /api/environments/{project_id}/logs/views/{short_id}/ Replace a log view · Logs views update #
Ask an LLM
“How do I replace a log view's filters and name?”
“Can I overwrite a log view with new filters?”
Tell an agent
Replace log view {short_id} in {project_id} with name {name} and filters {filters}.
Overwrite log view {short_id} in {project_id} with filters {filters}.
PATCH /api/environments/{project_id}/logs/views/{short_id}/ Change a log view · Logs views partial update #
Ask an LLM
“How do I pin or unpin a log view?”
“Can I change only the name of a log view?”
Tell an agent
Pin log view {short_id} in {project_id}.
Rename log view {short_id} in {project_id} to {name}.
DELETE /api/environments/{project_id}/logs/views/{short_id}/ Delete a log view · Logs views destroy #
Ask an LLM
“How do I delete a log view?”
“Can I remove a saved log view by its short ID?”
Tell an agent destructive · confirm first
Delete log view {short_id} from project {project_id}.
Remove saved log view {short_id} in {project_id}.
GET /api/projects/{project_id}/logs/alerts/ List log alerts in a project · Logs alerts list #
Ask an LLM
“Which log alerts are set up in my project?”
“Can I list log alerts with their thresholds?”
Tell an agent
List log alerts in project {project_id}.
Show log alerts in {project_id} with their thresholds.
POST /api/projects/{project_id}/logs/alerts/ Create a log alert · Logs alerts create #
Ask an LLM
“How do I create a log alert that fires when error logs exceed a count?”
“Can I set a log alert's evaluation window and check interval?”
Tell an agent
Create log alert {name} in {project_id} that fires when {threshold_count} logs match {filters} in {window_minutes} minutes.
Create a log alert in {project_id} checked every {check_interval_minutes} minutes.
GET /api/projects/{project_id}/logs/alerts/{id}/ Get a logs alert configuration · Logs alerts retrieve #
Ask an LLM
“How do I view one logs alert's filter and threshold?”
“Can I check whether a logs alert is firing?”
Tell an agent
Show logs alert {id} in project {project}.
Get the filter and threshold of logs alert {id}.
PUT /api/projects/{project_id}/logs/alerts/{id}/ Replace a log alert · Logs alerts update #
Ask an LLM
“How do I change a log alert's filters and threshold?”
“Can I replace a log alert with new filters and a name?”
Tell an agent
Replace log alert {id} in {project_id} with filters {filters} and threshold {threshold_count}.
Update log alert {id} in {project_id} with name {name}.
PATCH /api/projects/{project_id}/logs/alerts/{id}/ Update a logs alert · Logs alerts partial update #
Ask an LLM
“Can I change the severity filters on a logs alert?”
“How do I snooze a logs alert for a set time?”
Tell an agent
Update logs alert {id} in project {project_id}.
Change the severity filters on logs alert {id} to {filters}.
DELETE /api/projects/{project_id}/logs/alerts/{id}/ Delete a logs alert configuration · Logs alerts destroy #
Ask an LLM
“How do I permanently remove a logs alert?”
“Can I delete a logs alert configuration?”
Tell an agent destructive · confirm first
Delete logs alert {id} from project {project}.
Remove logs alert configuration {id}.
POST /api/projects/{project_id}/logs/alerts/{id}/destinations/ Add a notification destination to a logs alert · Logs alerts destinations create #
Ask an LLM
“How do I get a logs alert to post to a Slack channel?”
“Can I send logs alert notifications to a webhook URL?”
Tell an agent
Add a {type} destination to logs alert {id} in project {project_id}.
Send logs alert {id} notifications to Slack channel {channel} in workspace {workspace}.
POST /api/projects/{project_id}/logs/alerts/{id}/destinations/delete/ Delete a logs alert destination · Logs alerts destinations delete create #
Ask an LLM
“How do I stop a logs alert from notifying a destination?”
“Can I remove a webhook destination from a logs alert?”
Tell an agent destructive · confirm first
Delete destination {hog_function_ids} from logs alert {id} in project {project_id}.
Remove the webhook notification from logs alert {id}.
GET /api/projects/{project_id}/logs/alerts/{id}/events/ List events for a logs alert · Logs alerts events list #
Ask an LLM
“What state changes has a logs alert gone through?”
“Can I see the event history of a logs alert?”
Tell an agent
Show events for logs alert {id} in project {project_id}.
List the last {limit} events of logs alert {id}.
POST /api/projects/{project_id}/logs/alerts/{id}/reset/ Reset a broken logs alert · Logs alerts reset create #
Ask an LLM
“How do I clear the consecutive failure count on a logs alert?”
“Can I force a logs alert to recheck right away?”
Tell an agent
Reset logs alert {id} in project {project_id}.
Clear the consecutive failures on logs alert {id}.
POST /api/projects/{project_id}/logs/alerts/simulate/ Simulate a logs alert in a project · Logs alerts simulate create #
Ask an LLM
“Can I preview a logs alert against historical logs before saving it?”
“How many events would a logs alert fire over the last 30 days?”
Tell an agent
Simulate logs alert {filters} in project {project} over {date_from} at {threshold_count} {operator} {window}.
Dry-run a logs alert with {threshold_count} {operator} {window} for filters {filters}, from {date_from}.
GET /api/projects/{project_id}/logs/attributes/ List attributes from logs · Logs attributes retrieve #
Ask an LLM
“Which attributes are most common across my logs?”
“Can I search logs attributes and see which values appear?”
Tell an agent
List logs attributes in project {project}.
Find logs attributes matching {search} for services {services}.
POST /api/projects/{project_id}/logs/count/ Count logs matching a query · Logs count create #
Ask an LLM
“How many logs match a given query?”
“Can I count logs by severity over a time range?”
Tell an agent
Count logs in project {project_id} matching {query}.
Count {query} logs in project {project_id}.
POST /api/projects/{project_id}/logs/count-ranges/ Count logs in time buckets · Logs count ranges create #
Ask an LLM
“Can I get a time series of log counts over a range?”
“What does the log volume look like per hour?”
Tell an agent
Count logs in project {project_id} over time buckets for {query}.
Bucket log counts in project {project_id} for {query}.
POST /api/projects/{project_id}/logs/export/ Export logs · Logs export create #
Ask an LLM
“How do I export all my logs to a file?”
“Can I download logs as a CSV?”
Tell an agent
Export logs in project {project_id}.
Start a logs export for project {project_id}.
GET /api/projects/{project_id}/logs/has_logs/ Check whether a project has logs · Logs has logs retrieve #
Ask an LLM
“Does my project have any logs ingested?”
“How do I confirm logs are flowing into a project?”
Tell an agent
Check whether project {project_id} has logs.
Confirm logs are ingested in project {project_id}.
POST /api/projects/{project_id}/logs/query/ Query logs · Logs query create #
Ask an LLM
“Can I search logs for a keyword?”
“What does a specific log line contain?”
Tell an agent
Query logs in project {project_id} for {query}.
Find logs matching {query} in project {project_id}.
GET /api/projects/{project_id}/logs/sampling_rules/ List log sampling rules · Logs sampling rules list #
Ask an LLM
“Which log sampling rules are configured for my project?”
“Can I see the priority order of log sampling rules?”
Tell an agent
List log sampling rules in project {project_id}.
Show the first {limit} log sampling rules in project {project_id}.
POST /api/projects/{project_id}/logs/sampling_rules/ Create a log sampling rule · Logs sampling rules create #
Ask an LLM
“How do I drop logs from a service to save storage?”
“Can I sample logs by severity?”
Tell an agent
Create log sampling rule {name} in project {project_id} with config {config}.
Add a {rule_type} sampling rule for service {service} in project {project_id}.
GET /api/projects/{project_id}/logs/sampling_rules/{id}/ Get a logs sampling rule · Logs sampling rules retrieve #
Ask an LLM
“How do I view one logs sampling rule's filter?”
“Can I check the service a logs sampling rule applies to?”
Tell an agent
Show logs sampling rule {id} in project {project}.
Get the filter of logs sampling rule {id}.
PUT /api/projects/{project_id}/logs/sampling_rules/{id}/ Replace a log sampling rule · Logs sampling rules update #
Ask an LLM
“How do I fully overwrite a log sampling rule?”
“Can I change the priority of a log sampling rule?”
Tell an agent
Replace log sampling rule {id} in project {project_id} with name {name} and config {config}.
Overwrite sampling rule {id} in project {project_id}.
PATCH /api/projects/{project_id}/logs/sampling_rules/{id}/ Change fields of a log sampling rule · Logs sampling rules partial update #
Ask an LLM
“Can I disable a log sampling rule without deleting it?”
“How do I move a log sampling rule up in priority?”
Tell an agent
Disable log sampling rule {id} in project {project_id}.
Set the priority of log sampling rule {id} in project {project_id} to {priority}.
DELETE /api/projects/{project_id}/logs/sampling_rules/{id}/ Delete a log sampling rule · Logs sampling rules destroy #
Ask an LLM
“How do I remove a log sampling rule?”
“Can I delete a log sampling rule by ID?”
Tell an agent destructive · confirm first
Delete log sampling rule {id} from project {project_id}.
Remove the sampling rule {id} in project {project_id}.
POST /api/projects/{project_id}/logs/sampling_rules/{id}/simulate/ Estimate how much volume a sampling rule removes · Logs sampling rules simulate create #
Ask an LLM
“Can I estimate how many logs a sampling rule would filter out?”
“Is there a dry-run to see sampling rule impact before applying it?”
Tell an agent
Simulate logs sampling rule {id} in project {project} to estimate volume removed.
Dry-run sampling rule {id} and return an estimated volume reduction.
POST /api/projects/{project_id}/logs/sampling_rules/reorder/ Reorder log sampling rules · Logs sampling rules reorder create #
Ask an LLM
“Can I change the priority order of sampling rules?”
“What happens to sampling rule priorities when I reorder them?”
Tell an agent
Reorder sampling rules {ids} in project {project}.
Set the log sampling rule priority order to {ids}.
POST /api/projects/{project_id}/logs/services/ Create a logs service · Logs services create #
Ask an LLM
“How do I create a new service for logs in my project?”
“Can I define a service to group log entries?”
Tell an agent
Create a logs service in project {project_id} with query {query}.
Define a new service for logs using {query}.
POST /api/projects/{project_id}/logs/sparkline/ Create a logs sparkline · Logs sparkline create #
Ask an LLM
“Can I get a sparkline of log counts over time?”
“How do I chart log volume for a date range?”
Tell an agent
Create a logs sparkline in project {project_id} with query {query}.
Chart log volume over time for {query}.
GET /api/projects/{project_id}/logs/values/ List distinct log values for a key · Logs values retrieve #
Ask an LLM
“What values appear for a log attribute in my project?”
“Can I filter log values by service or date range?”
Tell an agent
List values for {key} in project {project_id}.
Show {attribute_type} values for {key} in project {project_id} over {dateRange}.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/posthog:posthog-logs-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

posthog-logs-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: PostHog Logs API
  version: 1.0.0
  description: ''
tags:


# --- truncated at 32 KB (120 KB total) ---
# Full source: https://artifacts.apis.io/posthog/openapi/posthog-logs-api-openapi.yml