Setting the file. One moment.
Subchapter 151.3
references/debug-logs-mcp.mdMarkdown2 KBView on GitHub
The PostHog MCP server gives AI agents direct access to your Logs. Ask your agent to search, filter, and analyze log data without leaving your code editor.
With MCP, your agents can:
This works in any MCP client – Cursor, Windsurf, Claude Code, and others.
Try these prompts with your MCP-enabled agent:
Show me all error logs from the last hour.What services are logging errors? Search for error logs from the payments service.Find logs related to trace ID abc123.What log attributes are available? Show me the values for the service.name attribute.Show me warning and error logs from the last 24 hours, excluding debug noise.The MCP server provides three tools for working with logs:
| Tool | Description |
|---|---|
| logs-query | Search and query logs with filters for severity levels (trace, debug, info, warn, error, fatal), service names, date ranges, and free text. Supports pagination for large result sets. |
| logs-list-attributes | List available log attributes in your project to discover what you can filter on. Supports filtering by attribute type (log or resource). |
| logs-list-attribute-values | Get possible values for a specific log attribute. Find service names, log levels, or other attribute values before querying. |
A typical workflow:
logs-list-attributes to discover available filter attributes.logs-list-attribute-values to find specific values (e.g., which service names exist).logs-query to search logs with the right filters.See the MCP server documentation (opens in a new tab) for setup instructions.
Ask a question
HelpfulCould be better