Skip to content

Conversation

@elboulangero
Copy link
Contributor

No description provided.

When a *mirror* is scanned, the number of files removed is logged:

```
2025/05/19 01:21:10.644 UTC [archive-4.kali.org] Requesting file list via rsync...
2025/05/19 01:22:42.670 UTC [archive-4.kali.org] Indexed 490848 files (490847 known), 3807 removed
```

However when the *source* is scanned, it's not logged:

```
2025/05/19 00:25:22.639 UTC [source] Scanning the filesystem...
2025/05/19 00:25:58.265 UTC [source] Indexing the files...
2025/05/19 00:26:02.360 UTC [source] Scanned 490848 files
```

The number of removed files can be useful information, and it's trivial
to add it to the log, so let's add it.

Additionally, this commit trades the term "Scanned" for "Indexed", to
align with the term that is used for the *mirror* scans (above).

After this commit, the logs now look like that:

```
2025/05/19 00:25:22.639 UTC [source] Scanning the filesystem...
2025/05/19 00:25:58.265 UTC [source] Indexing the files...
2025/05/19 00:26:02.360 UTC [source] Indexed 490848 files, 3807 removed
```
So far, when a mirror is scanned, we have two logs: when it starts, and
when it ends:

```
2025/05/19 01:21:10.644 UTC [archive-4.kali.org] Requesting file list via rsync...
2025/05/19 01:22:42.670 UTC [archive-4.kali.org] Indexed 490848 files (490847 known), 3807 removed
```

We don't have a timestamp in the middle, to indicate that the scan is
finished, and we're about to commit the result to the database. Too bad,
as it's sometimes useful to know how long it took for the scan, and how
long it took for the commit.

And as we can see, when the source is scanned, we do have this
information:

```
2025/05/19 00:25:22.639 UTC [source] Scanning the filesystem...
2025/05/19 00:25:58.265 UTC [source] Indexing the files...
2025/05/19 00:26:02.360 UTC [source] Indexed 490848 files, 3807 removed
```

So this commit aligns the logs for mirror scan with the logs for source
scan: it adds this extra log before starting the commit operation.

Now the logs look like that:

```
2025/05/19 01:21:10.644 UTC [archive-4.kali.org] Requesting file list via rsync...
2025/05/19 01:22:37.927 UTC [archive-4.kali.org] Indexing the files...
2025/05/19 01:22:42.670 UTC [archive-4.kali.org] Indexed 490848 files (490847 known), 3807 removed
```
@jbkempf jbkempf merged commit 510f10c into etix:master Aug 28, 2025
3 checks passed
@elboulangero elboulangero deleted the better-scan-logs branch August 28, 2025 06:43
@jbkempf jbkempf added this to the v0.6.2 milestone Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants