Automatic workspace path repair
Log Lens stores absolute file paths for every log it has ingested - both the raw source files and the per-stream copies it fetched. If you move your Log Lens workspace to a new location (a new home directory, a renamed project folder, a restored backup), those stored paths suddenly point nowhere. Automatic workspace path repair fixes them for you, so you keep your indexed history instead of re-ingesting everything.
What it does
On startup, Log Lens records a fingerprint of your current workspace - the resolved locations of the processed and sources directories. It compares that fingerprint against the one it saw last time:
- If the workspace is unchanged, repair is a no-op and nothing is touched.
- If the workspace has moved, Log Lens walks every stored path and relocates the ones that have gone missing.
For each source_files row and each source_streams row, repair only acts when the recorded path is no longer a real file. It then rebuilds the path by finding the /processed/ or /sources/ segment in the old path, keeping the part after it, and re-rooting that under the current directory:
old: /old/workspace/sources/app/laravel.log
new: /new/workspace/sources/app/laravel.log
When a stream is relocated, its linked source file is realigned to the same new path.
Safety checks
A candidate is accepted only when it passes every check, so a wrong file is never silently swapped in:
| Check | Behavior |
|---|---|
| File exists | The rebuilt path must resolve to a real file |
| Size matches | The file's byte size must equal the expected size (the stored size, or a stream's fetched offset) |
| No traversal | Relative paths containing .. or empty paths are rejected |
The size match is what makes repair trustworthy: if the relocated file has grown, shrunk, or is a different file, the candidate is skipped and the stale path is left untouched for you to reconcile manually.
Details and edge cases
- The whole pass runs in a single transaction. If anything fails, all changes roll back - you never end up with half-repaired paths.
- Only paths that live under
processed/orsources/are eligible; anything outside those roots is left alone. - After a successful run, the new workspace fingerprint is remembered so the next startup is a fast no-op.
- Paths that can't be confidently relocated stay as-is, ready for manual reconciliation.