Skip to content

log list returns empty for unselected project slugs #1317

Description

@sentry-junior

Reported by Sergiy Dybskiy.

sentry log list <org>/<project> can return No logs found in the last 30d even when the Events API has plenty of logs for that project. Org-wide explore/aggregate queries still work.

Root cause (high confidence)

In src/lib/api/logs.ts, listLogs() scopes slug targets only via search syntax:

const projectFilter = isNumericProject ? "" : `project:${projectSlug}`;
// ...
project: isNumericProject ? [Number(projectSlug)] : undefined,

For a normal slug it never sends the numeric project= query param. The logs Events API then only matches if that project is actively selected; otherwise it returns empty data: [] with no error.

Same class of bug already fixed for issues in #312.

Evidence

Against a project with hasLogs=true and hundreds of thousands of logs in 7d:

  • org-wide logs query → works
  • query=project:<slug> only → empty
  • project=<numeric-id> → works
  • query=project:<slug>&project=-1 → works
  • sentry log list <org>/<slug> → empty
  • sentry log list <org>/<numeric-id> → works
  • some other projects still work via slug (selection-dependent)

Secondary gap

  • Explicit org/project resolution returns slug only and drops projectId
  • getLogs() (log view by id) uses the same project:{slug} pattern

Workaround

Pass the numeric project id:

sentry log list <org>/<project-id>

Likely fix

Resolve slug → numeric project id and pass project: [id] on the Events request (mirror issues), instead of relying on query=project:{slug} for scoping.

Requested by Burak Yigit Kaya via Junior.

--

View Junior Session in Sentry

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingjaredTrigger the Jared agent to work on stuff

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions