{"slug": "query-neon-backend-logs", "title": "Query Neon backend logs", "summary": "Neon has launched `neon logs` in beta, a CLI command that lets developers query backend logs for Neon Functions and Object Storage on a branch, with filters for source, severity, and message text. The same log stream is also available through the Neon MCP server, the Logs API, @neon/sdk, and raw Loki endpoints. The feature is part of the Neon backend beta, which includes serverless Node.js compute and S3-compatible object storage, and is designed to simplify debugging across the stack.", "body_md": "We keep expanding our [backend](https://neon.com/blog/neon-backend-is-beta) observability. The most recent addition: you can now query backend logs outside the Console!\n\n`neon logs`\n\nreads what Neon Functions and Object Storage emit on a branch, with filters for source, severity, and message text. The same log stream is also available through the [Neon MCP server](https://neon.com/docs/ai/neon-mcp-server), the [Logs API](https://opentelemetry.io/docs/specs/otel/logs/api/), [@neon/sdk](https://neon.com/docs/reference/sdk), and raw [Loki](https://grafana.com/docs/loki/latest/) endpoints.\n\n## A quick recap: Functions and Object Storage\n\n`neon logs`\n\nis in beta, and it currently covers Neon Functions and Object Storage on a branch. If you haven’t been following the progress of the [Neon backend beta](https://neon.com/blog/neon-backend-is-beta), these are the newer primitives sitting next to [Lakebase Postgres](https://neon.com/docs/postgres/overview) (the Neon database):\n\n[Neon Functions](https://neon.com/docs/compute/functions/overview)are serverless Node.js compute you deploy onto your Neon branch, so your backend code runs next to your database. They’re long-running enough for streaming agents and realtime work.[Neon Object Storage](https://neon.com/docs/storage/overview)is S3-compatible object storage built into a Neon branch, so you can deploy buckets that branch with your data. Point a standard S3 SDK or tool at your branch endpoint, authenticate with a Neon credential, and you’re done.\n\n#### Logs coming soon for Postgres compute, Managed Better Auth, and AI Gateway\n\nThese don’t show up in `neon logs`\n\nyet - working on it.\n\n## Inspect Functions and Object Storage logs from the CLI\n\nThe Neon Console already had a Logs tab for [Functions](https://neon.com/docs/compute/functions/logs) and [Object Storage](https://neon.com/docs/storage/logs). What’s new is a branch-scoped CLI surface for the same log stream.\n\nThat matters when you’re debugging across the stack. A failed upload and a function error often show up in different places. With `neon logs`\n\n, you query them the same way, from the same branch context the rest of the CLI already uses.\n\nThere’s three key subcommands:\n\n`neon logs query`\n\n: returns log records over a time window (defaults to the last hour, newest first)`neon logs fields`\n\n: lists the fields a branch reports for filtering`neon logs field-values <field>`\n\n: lists distinct values for a field (defaults to the last six hours)\n\nPlus,\n\n- You can filter by\n`--source function|storage`\n\n, service or scope name, severity, body text, or trace ID. Or pass`--logql`\n\nfor a raw LogQL expression when the structured filters aren’t enough. - Project and branch resolve from your CLI context, same as other branch-scoped commands. Pass\n`--project-id`\n\nand`--branch`\n\nwhen you need to target something else. - Table output is the default. Use\n`--output json`\n\nor`--output yaml`\n\nwhen you want the full records (and the pagination cursor) for scripts or an agent.\n\n[Review our docs](http://neon.com/docs/cli/logs) for all the info.\n\n## Same logs in MCP, the API, and Loki\n\nThe CLI isn’t the only surface: the same log stream is also available for your agents / programmatic tooling.\n\n- The\n[Neon MCP server](https://neon.com/docs/ai/neon-mcp-server)exposes the same log workflow as read-only tools in the`observability`\n\ncategory. Once MCP is connected, you can ask your agent something like, “Why did my function error in the last hour? Check the logs.” - For scripts and apps, the same operations are in the\n[Logs API](https://neon.com/docs/reference/api/logs)(OpenAPI) and`@neon/sdk`\n\n- We’re also exposing\n[raw Loki endpoints](https://grafana.com/docs/loki/latest/), for Grafana users - you can query Neon backend logs with tooling that already speaks LogQL\n\n## Try it\n\nIf you haven’t spun up the [Neon backend beta](https://neon.com/blog/neon-backend-is-beta) yet, this is a good moment! Create a project in AWS US East (Ohio), deploy a function and a bucket, then pull the logs from your terminal — or even better: [ ask your agent over MCP](https://grafana.com/docs/loki/latest/).", "url": "https://wpnews.pro/news/query-neon-backend-logs", "canonical_source": "https://neon.com/blog/query-neon-backend-logs", "published_at": "2026-08-18 12:00:00+00:00", "updated_at": "2026-08-18 18:40:46.892994+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools"], "entities": ["Neon", "Neon Functions", "Neon Object Storage", "Neon MCP server", "Logs API", "@neon/sdk", "Loki", "Lakebase Postgres"], "alternates": {"html": "https://wpnews.pro/news/query-neon-backend-logs", "markdown": "https://wpnews.pro/news/query-neon-backend-logs.md", "text": "https://wpnews.pro/news/query-neon-backend-logs.txt", "jsonld": "https://wpnews.pro/news/query-neon-backend-logs.jsonld"}}