This commit is contained in:
Mateusz Gruszczyński committed 2026-11-23 23:03:30 +01:00
1 parent 96eec3b1c6
commit b9a5b3c153
30 files changed
+1100 -374

No files matched your search

+3 -6
View File
@@ -204,8 +204,7 @@ button:focus-visible {
}
.quiet:hover,
.top-log-menu[open]>summary,
.file-log-search-help[open]>summary {
.top-log-menu[open]>summary {
color: var(--text);
border-color: var(--border-hover);
}
@@ -1348,8 +1347,7 @@ html[data-interface-icons="true"] .network-interface-hidden .quiet>svg.ui-icon {
.metric-info,
.top-log-menu,
.backend-column-picker,
.file-log-search-help {
.backend-column-picker {
position: relative;
}
@@ -1372,8 +1370,7 @@ html[data-interface-icons="true"] .network-interface-hidden .quiet>svg.ui-icon {
.top-log-menu>summary::-webkit-details-marker,
.function-live-chart-summary::-webkit-details-marker,
.backend-column-picker>summary::-webkit-details-marker,
.log-column-picker>summary::-webkit-details-marker,
.file-log-search-help>summary::-webkit-details-marker {
.log-column-picker>summary::-webkit-details-marker {
display: none;
}
+1 -2
View File
@@ -607,8 +607,7 @@ main {
}
.top-log-menu>summary,
.backend-column-picker>summary,
.file-log-search-help>summary {
.backend-column-picker>summary {
list-style: none;
cursor: pointer;
user-select: none;
+1 -2
View File
@@ -2108,8 +2108,7 @@ html:is([data-corner-style=square], [data-corner-style=subtle], [data-corner-sty
border-radius: var(--rp-progress-radius);
}
#panel-overview .stat-meter>small,
.file-log-search-help-popover code {
#panel-overview .stat-meter>small {
display: block;
overflow-wrap: anywhere;
}
-21
View File
@@ -597,7 +597,6 @@ p,
#panel-tls .certificate-subheading h3,
#panel-tls .certificate-library-footer p,
.cache-operation-dialog .card,
.file-log-search-help-popover p,
.file-logs-table-toolbar .fine,
.cache-maintenance-help .subheading,
.path-permissions p {
@@ -622,21 +621,6 @@ p,
gap: 8px;
}
.vh-header-rule-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-bottom: 8px;
}
.vh-header-rule-title {
font: 600 10px var(--mono);
color: var(--muted);
text-transform: uppercase;
letter-spacing: .45px;
}
.vh-header-rule-fields {
display: grid;
align-items: end;
@@ -1468,11 +1452,6 @@ html[data-dashboard-density=ultra] #panel-overview .dashboard-overview-grid>.car
color: var(--muted);
}
.location-header-editor .vh-header-rule-head>button {
margin-left: auto;
flex: 0 0 auto;
}
.listener-protocol-settings-actions {
display: flex;
gap: 14px;
+101 -36
View File
@@ -775,23 +775,9 @@ button.config-history-day.is-selected,
min-height: 32px;
}
.file-log-search-help-popover {
position: absolute;
z-index: 90;
top: calc(100% + 6px);
inset-inline-end: 0;
display: grid;
gap: 7px;
width: calc(min(420px, calc(100 * var(--rp-vw)) - 36px));
padding: 12px;
border: 1px solid var(--line);
background: var(--panel2);
box-shadow: 0 12px 28px var(--shadow-strong);
}
.file-logs-filter {
display: grid;
grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) minmax(110px, 150px);
grid-template-columns: minmax(200px, 1.4fr) minmax(200px, 1.4fr) minmax(150px, 1fr) minmax(100px, 130px);
gap: 10px;
align-items: end;
--toolbar-control-height: min(var(--button-min-height), var(--ui-field-min-height));
@@ -799,6 +785,106 @@ button.config-history-day.is-selected,
.file-logs-filter .file-log-search {
grid-column: auto;
min-width: 0;
}
.file-logs-filter .is-disabled {
opacity: .55;
}
.file-log-search-row {
display: grid;
grid-column: 1/-1;
grid-template-columns: minmax(0, 1fr) auto;
align-items: end;
gap: 8px;
}
.file-log-syntax-toggle.active {
border-color: var(--accent);
color: var(--accent);
}
/* Search syntax help: an inline panel inside the workspace (never off-screen). */
.file-log-syntax {
display: grid;
grid-column: 1/-1;
gap: 6px;
padding: 10px 12px;
border: 1px solid var(--line);
border-left: 2px solid var(--accent);
background: var(--panel2);
}
.file-log-syntax[hidden] {
display: none;
}
.file-log-syntax p {
margin: 0;
}
.file-log-syntax-examples {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.file-log-syntax-examples button {
font: 11px var(--mono);
border-radius: 999px;
padding: 3px 10px;
}
.file-log-chips {
display: flex;
flex-wrap: wrap;
grid-column: 1/-1;
gap: 6px;
}
.file-log-chip {
border: 1px solid var(--line);
border-radius: 999px;
background: transparent;
color: var(--muted);
padding: 3px 12px;
font: 600 11px var(--mono);
cursor: pointer;
}
.file-log-chip.active {
border-color: var(--accent);
color: var(--text);
background: var(--panel2);
}
.file-log-chip.is-2xx.active { border-color: var(--green); }
.file-log-chip.is-4xx.active,
.file-log-chip.is-protocol.active { border-color: var(--notice-line); }
.file-log-chip.is-5xx.active { border-color: var(--red); }
#file-log-summary strong {
color: var(--text);
}
.file-log-summary-hint {
color: var(--notice-text);
}
.file-log-summary-hint.is-info {
color: var(--muted);
}
.file-logs-table tr[data-status-class="5xx"] td[data-mobile-column=status],
.file-logs-table tr[data-event] td[data-mobile-column=event] {
color: var(--red);
font-weight: 600;
}
.file-logs-table tr[data-status-class="4xx"] td[data-mobile-column=status] {
color: var(--notice-text);
font-weight: 600;
}
.file-log-column-picker {
@@ -937,29 +1023,8 @@ html[data-table-density=ultra] .file-log-inline-detail pre {
line-height: 1.55;
}
.file-logs-heading-actions .file-log-consolidate {
display: inline-flex;
align-items: center;
gap: .45rem;
padding: .35rem .55rem;
min-height: 0;
color: var(--muted);
font-size: .8rem;
font-weight: 400;
white-space: nowrap;
cursor: pointer;
}
.file-log-consolidate input {
width: 14px;
height: 14px;
margin: 0;
accent-color: var(--accent);
}
.page-footer .footer-update:hover,
.certificate-details summary:hover,
.file-log-consolidate:hover,
.file-log-tab:hover,
.config-history-change-values .diff-after {
color: var(--text);
+52 -19
View File
@@ -440,11 +440,19 @@
#panel-tls .certificate-tabs,
#panel-tls .renewal-meta,
.file-log-column-picker .log-column-options,
.file-log-field,
.file-logs-filter {
.file-log-field {
grid-template-columns: 1fr;
}
.file-logs-filter {
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.file-logs-filter .file-log-source,
.file-logs-filter .file-log-file {
grid-column: 1/-1;
}
#panel-tls .renewal-actions {
justify-content: stretch;
}
@@ -467,10 +475,6 @@
gap: 8px;
}
.file-logs-heading-actions .file-log-consolidate {
margin-inline-end: auto;
}
.file-log-tab {
padding: .6rem .7rem;
}
@@ -524,15 +528,6 @@
gap: 4px;
}
#panel-filelogs .file-logs-heading-actions .file-log-consolidate {
margin-inline-end: auto;
white-space: normal;
}
#panel-filelogs .file-log-search-help-popover {
width: calc(min(320px, calc(100 * var(--rp-vw)) - 54px));
}
#panel-filelogs .file-log-aggregate-form,
#panel-filelogs .file-logs-filter,
#panel-filelogs .file-log-field {
@@ -627,11 +622,43 @@
font-size: 11px;
}
#panel-filelogs .file-logs-table td[data-mobile-column=time],
#panel-filelogs .file-logs-table td[data-mobile-column=vhost] {
#panel-filelogs .file-logs-table td[data-mobile-column=time] {
color: var(--muted);
font-size: 11px;
grid-column: 1/-1;
order: -2;
}
#panel-filelogs .file-logs-table td[data-mobile-column=status] {
order: -1;
text-align: end;
}
#panel-filelogs .file-logs-table td[data-mobile-column=time]:before,
#panel-filelogs .file-logs-table td[data-mobile-column=status]:before {
content: "" !important;
}
#panel-filelogs .file-logs-table td[data-mobile-column=record] {
order: -1;
}
#panel-filelogs .file-logs-table td[data-mobile-column=vhost],
#panel-filelogs .file-logs-table td[data-mobile-column=source] {
color: var(--muted);
font-size: 11px;
}
#panel-filelogs .file-logs-table tbody tr[data-status-class="5xx"],
#panel-filelogs .file-logs-table tbody tr[data-event] {
border-left: 3px solid var(--red);
}
#panel-filelogs .file-logs-table tbody tr[data-status-class="4xx"] {
border-left: 3px solid var(--notice-line);
}
#panel-filelogs .file-logs-table tbody tr[data-status-class="2xx"] {
border-left: 3px solid var(--pill-live-line);
}
#panel-filelogs .file-logs-table tbody tr:not(.file-log-detail-row)>td:before {
@@ -2073,4 +2100,10 @@
.docker-passive-health-editor>summary>span {
flex: 0 0 190px;
}
}
}
@media (max-width: 760px) {
/* Plain request records do not need an "Event: request" line on phones. */
#panel-filelogs .file-logs-table tbody tr:not([data-event]) td[data-mobile-column=event] {
display: none;
}
}
+124 -50
View File
@@ -13,14 +13,12 @@
let visibleColumns = new Set(defaultColumnIds);
let sortBy = "time", sortDescending = true, pendingRefresh = false;
const CONSOLIDATION_STORAGE_KEY = "rp-file-logs-consolidate-vhosts";
const consolidationToggle = $("file-log-consolidate-vhosts");
try {
const saved = localStorage.getItem(CONSOLIDATION_STORAGE_KEY);
if (consolidationToggle && (saved === "1" || saved === "0")) consolidationToggle.checked = saved === "1";
} catch { }
// Sources are shown per log (a site with all its rotations); the File picker
// narrows to one rotation. Rotation 0 is the file being written.
let groups = new Map(), statusFilter = "", eventFilter = "";
const SCOPE_ORDER = ["vhost", "redirect", "host404", "unmatched", "access", "error"];
const sourceSelect = () => $("file-log-source");
const fileSelect = () => $("file-log-file");
function setView(view) {
activeView = view === "counts" ? "counts" : "entries";
for (const name of ["entries", "counts"]) {
@@ -32,41 +30,70 @@
}
if (activeView === "counts" && aggregateField) void refresh(true);
}
function sourceOption(source) {
const grouped = Number(source.member_count) > 1 ? ` · ${fmt(source.member_count)} ${t("fileLogsFiles")}` : "";
const label = `${source.label}${grouped} · ${source.format} · ${bytes(Number(source.size) || 0)}`;
const option = el("option", label); option.value = source.id; return option;
function scopeOf(source) {
if (source.scope) return source.scope;
return String(source.group_id || "").startsWith("vhost:") ? "vhost" : source.kind || "access";
}
function displaySources(sources) {
if (!$("file-log-consolidate-vhosts")?.checked) return sources;
const output = [], groups = new Map();
function groupLabel(group) {
if (group.scope === "access") return t("fileLogsAccessLog");
if (group.scope === "error") return t("fileLogsErrorLog");
if (group.scope === "unmatched") return t("fileLogsUnmatched");
return group.site || group.id.replace(/^vhost:/, "");
}
function fileLabel(source) {
const rotation = Number(source.rotation) || 0;
const name = rotation === 0 ? t("fileLogsCurrentFile") : rotation >= 4294967295 ? source.label : `.${rotation}${source.compressed ? ".gz" : ""}`;
const when = Number(source.modified_ms) ? ` · ${formatDateTime(Number(source.modified_ms))}` : "";
return `${name} · ${bytes(Number(source.size) || 0)}${when}`;
}
function buildGroups(sources) {
const result = new Map();
for (const source of sources) {
if (!String(source.group_id || "").startsWith("vhost:")) { output.push(source); continue; }
const id = source.group_id;
let group = groups.get(id);
if (!group) {
group = { ...source, id, label: id.slice("vhost:".length), size: 0, member_count: 0, compressed: false };
groups.set(id, group); output.push(group);
}
group.size += Number(source.size) || 0; group.member_count += 1;
group.modified_ms = Math.max(Number(group.modified_ms) || 0, Number(source.modified_ms) || 0);
const id = source.group_id || source.id;
let group = result.get(id);
if (!group) { group = { id, scope: scopeOf(source), site: source.site || "", format: source.format, files: [], size: 0, modified_ms: 0 }; result.set(id, group); }
group.files.push(source); group.size += Number(source.size) || 0;
group.modified_ms = Math.max(group.modified_ms, Number(source.modified_ms) || 0);
}
return output;
for (const group of result.values()) group.files.sort((a, b) => (Number(a.rotation) || 0) - (Number(b.rotation) || 0) || (Number(b.modified_ms) || 0) - (Number(a.modified_ms) || 0));
return result;
}
function renderInventory(value) {
inventory = value;
const select = sourceSelect();
let selected = select.value || "all";
const rawSources = Array.isArray(value?.sources) ? value.sources : [];
if ($("file-log-consolidate-vhosts")?.checked && selected !== "all") {
const member = rawSources.find(source => source.id === selected);
if (member?.group_id?.startsWith("vhost:")) selected = member.group_id;
const select = sourceSelect(), previous = select.value || "all", previousFile = fileSelect().value || "all";
groups = buildGroups(Array.isArray(value?.sources) ? value.sources : []);
const options = [Object.assign(el("option", t("fileLogsAllSources")), { value: "all" })];
for (const scope of SCOPE_ORDER) {
const items = [...groups.values()].filter(group => group.scope === scope).sort((a, b) => compareText(groupLabel(a), groupLabel(b), false));
if (!items.length) continue;
const optgroup = document.createElement("optgroup"); optgroup.label = t(`fileLogsScope_${scope}`);
for (const group of items) {
const count = group.files.length > 1 ? ` · ${fmt(group.files.length)} ${t("fileLogsFiles")}` : "";
const option = el("option", `${groupLabel(group)}${count} · ${bytes(group.size)}`); option.value = group.id; optgroup.append(option);
}
options.push(optgroup);
}
const sources = displaySources(rawSources);
const options = [Object.assign(el("option", t("fileLogsAllSources")), { value: "all" }), ...sources.map(sourceOption)];
select.replaceChildren(...options);
select.value = sources.some(source => source.id === selected) ? selected : "all";
// A file id (older bookmark) selects its group.
const owner = [...groups.values()].find(group => group.id === previous || group.files.some(file => file.id === previous));
select.value = owner ? owner.id : "all";
renderFiles(owner && owner.files.some(file => file.id === previousFile) ? previousFile : owner?.files.some(file => file.id === previous) ? previous : "all");
}
function renderFiles(selected = "all") {
const group = groups.get(sourceSelect().value), files = fileSelect();
const options = [Object.assign(el("option", t("fileLogsAllFiles")), { value: "all" })];
if (group) for (const source of group.files) options.push(Object.assign(el("option", fileLabel(source)), { value: source.id }));
files.replaceChildren(...options);
files.value = group?.files.some(file => file.id === selected) ? selected : "all";
files.disabled = !group || group.files.length < 2;
files.closest("label").classList.toggle("is-disabled", files.disabled);
}
function sourceName(id) {
for (const group of groups.values()) {
const file = group.files.find(item => item.id === id);
if (file) return (Number(file.rotation) || 0) === 0 ? groupLabel(group) : `${groupLabel(group)} · .${file.rotation}`;
}
return id || "—";
}
async function loadInventory() {
const value = await api("/api/file-logs");
@@ -112,7 +139,8 @@
function columnValue(entry, id) {
if (id === "time") return entryTime(entry);
if (id === "record") return entrySummary(entry);
if (id === "source") return entry._source || "—";
if (id === "source") return sourceName(entry._source);
if (id === "vhost" && !entry.vhost && (entry.redirect_host || entry.local_host)) return entry.redirect_host ? `↪ ${entry.redirect_host}` : `404 · ${entry.local_host}`;
return displayValue(nestedValue(entry, id));
}
function columnLabel(id) {
@@ -253,6 +281,8 @@
const nodes = [];
entries.forEach((entry, index) => {
const row = el("tr"); row.tabIndex = 0; row.classList.toggle("selected", selectedIndex === index);
const status = Number(entry.status) || 0; if (status >= 100) row.dataset.statusClass = `${Math.floor(status / 100)}xx`;
if (entry.event && entry.event !== "request") row.dataset.event = entry.event;
row.setAttribute("aria-expanded", selectedIndex === index ? "true" : "false");
row.setAttribute("aria-label", entrySummary(entry));
for (const id of ids) {
@@ -272,10 +302,16 @@
}
function queryString() {
const params = new URLSearchParams();
const source = sourceSelect().value || "all";
if (source !== "all") params.set("source", source);
const source = sourceSelect().value || "all", file = fileSelect().value || "all";
if (source !== "all") {
if (file !== "all") params.set("source", file);
else { params.set("source", source); params.set("consolidate_vhosts", "true"); }
}
const q = $("file-log-q").value.trim(); if (q) params.set("q", q);
if ($("file-log-consolidate-vhosts")?.checked) params.set("consolidate_vhosts", "true");
const period = Number($("file-log-period").value) || 0;
if (period > 0) params.set("since_ms", String(Date.now() - period * 1000));
if (statusFilter) params.set("status_class", statusFilter);
if (eventFilter) params.set("event", eventFilter);
if (activeView === "counts" && aggregateField) {
params.set("aggregate_field", aggregateField);
params.set("aggregate_min_count", String(Math.max(2, Number($("file-log-aggregate-min")?.value) || 2)));
@@ -297,22 +333,48 @@
applyFields(Array.isArray(value.fields) ? value.fields : []);
renderRows(Array.isArray(value.entries) ? value.entries : []);
renderAggregation(value.aggregation || null);
const from = lastTotal ? offset + 1 : 0, to = Math.min(offset + currentLimit(), lastTotal);
$("file-log-summary").textContent = t("fileLogsSummary")
.replace("{from}", fmt(from)).replace("{to}", fmt(to)).replace("{total}", fmt(lastTotal))
.replace("{bytes}", bytes(Number(value.scanned_bytes) || 0)).replace("{lines}", fmt(Number(value.scanned_lines) || 0))
+ (value.truncated ? ` · ${t("fileLogsTruncated")}` : "");
renderSummary(value);
const byTime = sortBy === "time" && sortDescending;
$("file-logs-prev").textContent = t(byTime ? "fileLogsNewer" : "previous");
$("file-logs-next").textContent = t(byTime ? "fileLogsOlder" : "next");
$("file-logs-prev").disabled = offset === 0;
$("file-logs-next").disabled = offset + currentLimit() >= lastTotal;
} catch (error) { toast(error.message, true); }
finally { busy = false; $("file-logs-refresh").disabled = false; if (pendingRefresh) { pendingRefresh = false; void refresh(); } }
}
// Status line: what is shown, the time range and which files were read.
function renderSummary(value) {
const summary = $("file-log-summary"); summary.replaceChildren();
const from = lastTotal ? offset + 1 : 0, to = Math.min(offset + currentLimit(), lastTotal);
const main = el("strong", t("fileLogsSummaryShown").replace("{from}", fmt(from)).replace("{to}", fmt(to)).replace("{total}", fmt(lastTotal)));
summary.append(main);
const parts = [];
if (value.newest_ms && value.oldest_ms) parts.push(t("fileLogsSummaryRange").replace("{from}", formatDateTime(Number(value.oldest_ms))).replace("{to}", formatDateTime(Number(value.newest_ms))));
const files = Array.isArray(value.files) ? value.files : [];
const inGroup = groups.has(sourceSelect().value);
const fileName = file => inGroup ? ((Number(file.rotation) || 0) === 0 ? t("fileLogsCurrentFile") : `.${file.rotation}`) : sourceName(file.id);
if (files.length) parts.push(t("fileLogsSummaryFiles").replace("{files}", files.map(fileName).slice(0, 4).join(", ") + (files.length > 4 ? ` +${files.length - 4}` : "")));
parts.push(t("fileLogsSummaryScanned").replace("{lines}", fmt(Number(value.scanned_lines) || 0)).replace("{bytes}", bytes(Number(value.scanned_bytes) || 0)));
summary.append(el("span", ` · ${parts.join(" · ")}`));
const skipped = Number(value.files_skipped) || 0;
if (skipped > 0 || (value.truncated && !value.stopped_at_period)) {
const hint = el("span", "", "file-log-summary-hint");
hint.textContent = value.stopped_at_period
? t("fileLogsSummaryPeriod").replace("{count}", fmt(skipped))
: skipped > 0
? t("fileLogsSummarySkipped").replace("{count}", fmt(skipped))
: t("fileLogsSummaryTruncated");
hint.classList.toggle("is-info", Boolean(value.stopped_at_period));
summary.append(document.createElement("br"), hint);
}
}
function reset() {
inventory = null; offset = 0; lastTotal = 0; currentEntries = []; selectedIndex = null; aggregateField = "";
sortBy = "time"; sortDescending = true; pendingRefresh = false;
preferencesLoaded = false; preferenceSaveRunning = false; preferenceSaveQueued = false;
availableColumns = new Set(defaultColumnIds); visibleColumns = new Set(defaultColumnIds);
sourceSelect().replaceChildren(Object.assign(el("option", t("fileLogsAllSources")), { value: "all" }));
groups = new Map(); statusFilter = ""; eventFilter = ""; syncChips();
sourceSelect().replaceChildren(Object.assign(el("option", t("fileLogsAllSources")), { value: "all" })); renderFiles();
$("file-log-rows").replaceChildren(); $("file-log-aggregate-rows")?.replaceChildren(); renderAggregation(null); syncColumnPicker(); syncHeaders();
}
const fileLogTabs = [$("file-log-tab-entries"), $("file-log-tab-counts")];
@@ -333,12 +395,24 @@
$("file-logs-filter").addEventListener("submit", event => { event.preventDefault(); void refresh(true); });
$("file-log-q").addEventListener("input", () => { clearTimeout(searchTimer); searchTimer = setTimeout(() => void refresh(true), 250); });
$("file-log-limit").addEventListener("change", () => refresh(true));
sourceSelect().addEventListener("change", () => refresh(true));
consolidationToggle?.addEventListener("change", () => {
try { localStorage.setItem(CONSOLIDATION_STORAGE_KEY, consolidationToggle.checked ? "1" : "0"); } catch { }
if (inventory) renderInventory(inventory);
void refresh(true);
});
sourceSelect().addEventListener("change", () => { renderFiles(); void refresh(true); });
fileSelect().addEventListener("change", () => refresh(true));
$("file-log-period").addEventListener("change", () => refresh(true));
function syncChips() {
for (const chip of document.querySelectorAll("#file-log-chips .file-log-chip")) {
const active = (chip.dataset.status || "") === statusFilter && (chip.dataset.event || "") === eventFilter;
chip.setAttribute("aria-pressed", String(active)); chip.classList.toggle("active", active);
}
}
for (const chip of document.querySelectorAll("#file-log-chips .file-log-chip")) {
chip.addEventListener("click", () => { statusFilter = chip.dataset.status || ""; eventFilter = chip.dataset.event || ""; syncChips(); void refresh(true); });
}
// Search syntax help opens inline under the search field (works on phones too).
const syntaxToggle = $("file-log-syntax-toggle"), syntax = $("file-log-syntax");
syntaxToggle.addEventListener("click", () => { syntax.hidden = !syntax.hidden; syntaxToggle.setAttribute("aria-expanded", String(!syntax.hidden)); syntaxToggle.classList.toggle("active", !syntax.hidden); });
for (const example of syntax.querySelectorAll(".file-log-syntax-examples button")) {
example.addEventListener("click", () => { $("file-log-q").value = example.textContent.trim(); syntax.hidden = true; syntaxToggle.setAttribute("aria-expanded", "false"); syntaxToggle.classList.remove("active"); void refresh(true); });
}
$("file-log-aggregate-form")?.addEventListener("submit", event => { event.preventDefault(); aggregateField = $("file-log-aggregate-field").value.trim().toLowerCase(); if (!aggregateField) { renderAggregation(null); return; } void refresh(true); });
$("file-logs-prev").addEventListener("click", () => { offset = Math.max(0, offset - currentLimit()); void refresh(); });
$("file-logs-next").addEventListener("click", () => { if (offset + currentLimit() < lastTotal) { offset += currentLimit(); void refresh(); } });
+53 -21
View File
@@ -1906,21 +1906,6 @@
<h2 data-i18n="fileLogsTitle">Stored log explorer</h2>
</div>
<div class="file-logs-heading-actions">
<details class="file-log-search-help">
<summary class="quiet" data-i18n="fileLogsSearchHelp">Search syntax</summary>
<div class="file-log-search-help-popover">
<strong data-i18n="fileLogsSearchHelpTitle">Kibana-style field search</strong>
<p class="fine" data-i18n="fileLogsSearchHelpText">Use field:value clauses.
Clauses are joined with AND; prefix a clause with ! to exclude it. Quotes
keep spaces together.</p>
<code>req: GET AND !country: PL</code>
<code>status:&gt;=500 AND path:/api/*</code>
<code>error:"connection reset"</code>
</div>
</details>
<label class="file-log-consolidate" title="Consolidate vhost log rotations"><input class="switch"
checked id="file-log-consolidate-vhosts" type="checkbox" /><span
data-i18n="fileLogsConsolidateShort">Merge rotations</span></label>
<button class="outline" data-i18n="refresh" id="file-logs-refresh"
type="button">Refresh</button>
</div>
@@ -1932,9 +1917,18 @@
id="file-log-source">
<option data-i18n="fileLogsAllSources" value="all">All configured files</option>
</select></label>
<label class="file-log-search"><span data-i18n="search">Search</span><input id="file-log-q"
maxlength="512" data-i18n-placeholder="fileLogsSearchPlaceholder"
placeholder="req: GET AND !country: Poland" type="search" /></label>
<label class="file-log-file"><span data-i18n="fileLogsFile">File</span><select
id="file-log-file">
<option data-i18n="fileLogsAllFiles" value="all">All rotations, newest first</option>
</select></label>
<label class="file-log-period"><span data-i18n="fileLogsPeriod">Period</span><select
id="file-log-period">
<option data-i18n="fileLogsPeriodAll" value="0">Everything read</option>
<option data-i18n="fileLogsPeriod15m" value="900">Last 15 minutes</option>
<option data-i18n="fileLogsPeriod1h" value="3600">Last hour</option>
<option data-i18n="fileLogsPeriod24h" value="86400">Last 24 hours</option>
<option data-i18n="fileLogsPeriod7d" value="604800">Last 7 days</option>
</select></label>
<label class="file-log-limit"><span data-i18n="fileLogsPageSize">Page size</span><select
id="file-log-limit">
<option>50</option>
@@ -1942,6 +1936,44 @@
<option>250</option>
<option>500</option>
</select></label>
<div class="file-log-search-row">
<label class="file-log-search"><span data-i18n="search">Search</span><input
id="file-log-q" maxlength="512" data-i18n-placeholder="fileLogsSearchPlaceholder"
placeholder="req: GET AND !country: Poland" type="search" /></label>
<button aria-controls="file-log-syntax" aria-expanded="false"
class="quiet file-log-syntax-toggle" data-i18n="fileLogsSearchHelp"
id="file-log-syntax-toggle" type="button">Search syntax</button>
</div>
<section class="file-log-syntax" hidden id="file-log-syntax">
<strong data-i18n="fileLogsSearchHelpTitle">Kibana-style field search</strong>
<p class="fine" data-i18n="fileLogsSearchHelpText">Use field:value clauses. Clauses are
joined with AND; prefix a clause with ! to exclude it. Quotes keep spaces
together.</p>
<p class="fine" data-i18n="fileLogsSyntaxTryHint">Tap an example to use it:</p>
<div class="file-log-syntax-examples">
<button class="quiet" type="button">status:&gt;=500</button>
<button class="quiet" type="button">req: GET AND !country: PL</button>
<button class="quiet" type="button">status:&gt;=500 AND path:/api/*</button>
<button class="quiet" type="button">client_ip:203.0.113.10</button>
<button class="quiet" type="button">user_agent:*bot*</button>
<button class="quiet" type="button">error:"connection reset"</button>
</div>
</section>
<div aria-label="Status" class="file-log-chips" id="file-log-chips" role="group">
<button aria-pressed="true" class="file-log-chip" data-i18n="fileLogsChipAll"
data-status="" type="button">All</button>
<button aria-pressed="false" class="file-log-chip is-2xx" data-status="2xx"
type="button">2xx</button>
<button aria-pressed="false" class="file-log-chip is-3xx" data-status="3xx"
type="button">3xx</button>
<button aria-pressed="false" class="file-log-chip is-4xx" data-status="4xx"
type="button">4xx</button>
<button aria-pressed="false" class="file-log-chip is-5xx" data-status="5xx"
type="button">5xx</button>
<button aria-pressed="false" class="file-log-chip is-protocol"
data-event="protocol_error" data-i18n="fileLogsChipProtocol"
type="button">Protocol errors</button>
</div>
</form>
<div class="file-log-tabs" role="tablist" aria-label="Stored log views">
<button class="file-log-tab active" id="file-log-tab-entries" type="button" role="tab"
@@ -2008,9 +2040,9 @@
</div>
<p class="empty" data-i18n="fileLogsEmpty" id="file-logs-empty">No records match the current
search.</p>
<div class="file-logs-pager"><button class="quiet" data-i18n="previous" disabled
id="file-logs-prev" type="button">Previous</button><button class="quiet"
data-i18n="next" disabled id="file-logs-next" type="button">Next</button></div>
<div class="file-logs-pager"><button class="quiet" data-i18n="fileLogsNewer" disabled
id="file-logs-prev" type="button">Newer</button><button class="quiet"
data-i18n="fileLogsOlder" disabled id="file-logs-next" type="button">Older</button></div>
</div>
</article>
</section>
-4
View File
@@ -100,10 +100,6 @@ function headerEditors(parent, initial, target = read("headers"), onChange = cha
const holders = {}, adders = {}, emptyStates = {};
const renumber = direction => {
const rows = holders[direction];
[...rows.children].forEach((row, index) => {
const title = row.querySelector(".vh-header-rule-title");
if (title) title.textContent = `${t("headerRule")} ${index + 1}`;
});
if (emptyStates[direction]) emptyStates[direction].hidden = rows.children.length > 0;
};
const sync = () => {