Readable traffic log: drop heartbeat noise, surface visitors and errors
Deploy with Docker Compose / deploy (push) Successful in 50s

Replaces gin's default logger with a custom formatter:

- /auth/validate-admin (nginx auth_request subrequests — the 5-seconds
  flood that is not a user), /auth/refresh and /auth/check no longer log
  a line at all on success; their failures are kept.
- Human latency units (15ms, not 153020ns).
- Lines for requests from outside the docker subnet carry the client IP
  — the "who is using my site" line — while internal infrastructure
  successes stay lean.
- 4xx lines carry " !!", 5xx " !!! SERVER ERROR", both greppable.

The admin panel's Diagnostics log pane gains a "visitors only" filter
that keeps just the IP-suffixed and error lines (on by default).

Co-Authored-By: Claude Code <[email protected]>
This commit is contained in:
2026-09-22 23:20:22 +01:00
co-authored by Claude Code
parent a362d12ebc
commit 4c49f5e177
4 changed files with 194 additions and 2 deletions
+25 -1
View File
@@ -49,6 +49,15 @@ const blank = computed(() =>
vars.value.filter((v) => !v.set),
);
// Traffic view: a filter over the log tail for "who is using my site" —
// lines with a client IP (the formatter appends it only for real visitors
// and error statuses). Skips the standard line numbers of JSON-array output.
const trafficOnly = ref(true);
const shownLines = computed(() => {
if (!trafficOnly.value) return lines.value;
return lines.value.filter((l) => /\b(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(l.trim()) || l.includes("!!! SERVER ERROR") || l.includes(" !!"));
});
onMounted(() => {
fetchConfig();
fetchLogs();
@@ -92,12 +101,18 @@ onMounted(() => {
messages, newest last.
</p>
<div class="log-controls">
<label class="hint toggle">
<input type="checkbox" v-model="trafficOnly" /> visitors only
</label>
<Button :disabled="loadingLogs" @click="fetchLogs">
{{ loadingLogs ? "Loading…" : "Refresh" }}
</Button>
</div>
<p v-if="logsError" class="error">{{ logsError }}</p>
<pre v-else class="log-output">{{ lines.join("\n") }}</pre>
<p v-else-if="shownLines.length === 0" class="hint">
No {{ trafficOnly ? "visitor" : "" }} lines in the current tail.
</p>
<pre v-else class="log-output">{{ shownLines.join("\n") }}</pre>
</div>
</template>
@@ -137,6 +152,15 @@ td {
.log-controls {
display: flex;
justify-content: flex-end;
gap: 12px;
align-items: center;
}
.toggle {
display: flex;
gap: 4px;
align-items: center;
cursor: pointer;
}
.log-output {