clockworklabs / clockworklabs/SpacetimeDB

`spacetime logs` and `/v1/database/:name/logs` only retrieve logs from the current or most recent day

Open
#3,508 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

These interfaces resolve to DatabaseLogger::read_latest, which has the following TODO in it:

    pub async fn read_latest(logs_dir: ModuleLogsDir, num_lines: Option<u32>) -> String {
        // TODO: do we want to logs from across multiple files?

        let Some(num_lines) = num_lines else {
            let path = logs_dir.today();
            // look for the most recent logfile.

In standalone deployments, it's mildly inconvenient for users to locate the correct replica dir and manually view their log files. On Maincloud, older logs are entirely inaccessible. This is unfortunate.

Possible fixes include:

  1. When passed a num_lines parameter greater than the number of lines in the current file, also read the previous file.
  2. Accept a date as a parameter and read logs for that day.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at DatabaseLogger::read_latest and trace the spacetime logs command and /v1/database/:name/logs endpoint that call it. Decide whether the completed behavior should span log files, accept a date, or both, then verify that users can retrieve logs older than the current or most recent day.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability-sre
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.