Rotate a database target's archive monthly, daily or hourly (closes #379)
check / check (push) Successful in 3m27s

A database target's rotation setting (none, monthly, daily or hourly) puts the UTC period of each event's receive time in its archive file name, so each file holds exactly its period's events. It is on the new webhook page and both target forms, and shown in the target list. Renames move every one of a target's files and move them all back if one fails. The sweep prunes one file at a time under the target's lock and deletes a rotated file it leaves empty. Download opens one file at a time, oldest period first, finding each again under the target's current name. The target list names the current file and totals all of them.

Model: opus-5-5
This commit was merged in pull request #482.
This commit is contained in:
2026-10-03 04:18:37 +02:00
parent d8c60c9b67
commit 8b617efa63
36 changed files with 2125 additions and 406 deletions
+12 -3
View File
@@ -38,9 +38,9 @@
<p class="text-xs text-gray-500 mt-1">Optional. When filled in, the webhook is created with an HTTP target that delivers each event to this URL.</p>
</div>
<!-- The checkbox shows the pruning choice while checked. With
autocomplete="off", going back to the page does not
check the box again with the choice hidden. -->
<!-- The checkbox shows the pruning and rotation choices while
checked. With autocomplete="off", going back to the page
does not check the box again with the choices hidden. -->
<div class="form-group" x-data="collapsible"{{if .Form.Archive}} data-open{{end}}>
<label class="flex items-center gap-2 text-sm font-medium text-gray-700">
<input type="checkbox" name="archive" value="on"{{if .Form.Archive}} checked{{end}} autocomplete="off" @change="toggle" class="h-4 w-4">
@@ -55,6 +55,15 @@
{{end}}
</select>
<p class="text-xs text-gray-500 mt-1">Archived events older than this are deleted from the archive; never keeps them all.</p>
<div class="mt-3">
<label for="archive_rotation" class="label">Archive rotation</label>
<select id="archive_rotation" name="archive_rotation" class="input">
{{range .ArchiveRotationChoices}}
<option value="{{.Value}}"{{if .Selected}} selected{{end}}>{{.Label}}</option>
{{end}}
</select>
<p class="text-xs text-gray-500 mt-1">Starts a new archive file each month, day or hour (UTC), named for it; none keeps one file.</p>
</div>
</div>
</div>