v0.41.3
This commit is contained in:
1 parent
8d15429560
commit
dd9ecc48f1
21 files changed
+828
-141
No files matched your search
+51
-2
@@ -27,6 +27,8 @@ struct FileLogSource {
|
||||
scope: &'static str,
|
||||
/// Site id for per-site logs (vhost, redirect or 404 host id).
|
||||
site: String,
|
||||
/// Current configured hostnames, not inferred from historical log records.
|
||||
domains: Vec<String>,
|
||||
}
|
||||
/// Splits `<base>.jsonl[.<N>][.gz]` (or `<file>[.<N>][.gz]` for the global logs)
|
||||
/// into the rotation index; `None` for files that are not part of the set.
|
||||
@@ -124,11 +126,47 @@ fn source_from_path(
|
||||
rotation: 0,
|
||||
scope: kind,
|
||||
site: String::new(),
|
||||
domains: Vec::new(),
|
||||
}
|
||||
}
|
||||
include!("file_logs_io.rs");
|
||||
|
||||
fn configured_file_log_sources(config: &crate::config::Config) -> Vec<FileLogSource> {
|
||||
/// Build a scope-aware hostname catalog, including Docker assignments even when
|
||||
/// their writer is disabled/offline and currently discovered label publications.
|
||||
fn file_log_vhost_domains(
|
||||
config: &crate::config::Config,
|
||||
observed: &std::collections::BTreeMap<String, crate::docker::Observation>,
|
||||
) -> std::collections::HashMap<String, Vec<String>> {
|
||||
let mut domains: std::collections::HashMap<String, Vec<String>> = config
|
||||
.vhosts
|
||||
.iter()
|
||||
.map(|host| (host.id.clone(), host.frontend.hosts.clone()))
|
||||
.collect();
|
||||
for agent in &config.docker_agents.agents {
|
||||
for assignment in &agent.assignments {
|
||||
if let Ok(hosts) = crate::docker::assignment_hosts(assignment, agent) {
|
||||
domains
|
||||
.entry(crate::docker::generated_id(&agent.id, &assignment.service_key))
|
||||
.or_insert(hosts);
|
||||
}
|
||||
}
|
||||
}
|
||||
let (publications, _) = crate::docker::label_publications(config, observed);
|
||||
for publication in publications {
|
||||
domains
|
||||
.entry(crate::docker::generated_id(
|
||||
&publication.agent_id,
|
||||
&publication.assignment.service_key,
|
||||
))
|
||||
.or_insert(publication.hosts);
|
||||
}
|
||||
domains
|
||||
}
|
||||
|
||||
fn configured_file_log_sources(
|
||||
config: &crate::config::Config,
|
||||
observed: &std::collections::BTreeMap<String, crate::docker::Observation>,
|
||||
) -> Vec<FileLogSource> {
|
||||
let mut sources = Vec::new();
|
||||
if config.logging.file.per_vhost {
|
||||
let directory = std::path::PathBuf::from(&config.logging.file.directory);
|
||||
@@ -158,6 +196,7 @@ fn configured_file_log_sources(config: &crate::config::Config) -> Vec<FileLogSou
|
||||
}),
|
||||
256,
|
||||
);
|
||||
let vhost_domains = file_log_vhost_domains(config, observed);
|
||||
for (name, path, _) in entries {
|
||||
let Some((base, rest)) = name.split_once(".jsonl") else {
|
||||
continue;
|
||||
@@ -184,6 +223,14 @@ fn configured_file_log_sources(config: &crate::config::Config) -> Vec<FileLogSou
|
||||
);
|
||||
source.rotation = rotation;
|
||||
source.scope = scope;
|
||||
source.domains = match scope {
|
||||
"vhost" => vhost_domains.get(&site).cloned(),
|
||||
"redirect" => config.redirects.iter().find(|host| host.id == site)
|
||||
.map(|host| host.frontend.hosts.clone()),
|
||||
"host404" => config.not_found_hosts.iter().find(|host| host.id == site)
|
||||
.map(|host| host.frontend.hosts.clone()),
|
||||
_ => None,
|
||||
}.unwrap_or_default();
|
||||
source.site = site;
|
||||
sources.push(source);
|
||||
}
|
||||
@@ -258,6 +305,7 @@ fn file_log_sources_json(sources: &[FileLogSource]) -> Value {
|
||||
"rotation": source.rotation,
|
||||
"scope": source.scope,
|
||||
"site": source.site,
|
||||
"domains": source.domains,
|
||||
})
|
||||
})
|
||||
.collect(),
|
||||
@@ -265,7 +313,8 @@ fn file_log_sources_json(sources: &[FileLogSource]) -> Value {
|
||||
}
|
||||
async fn file_logs(State(state): State<Arc<App>>) -> Result<Json<Value>, ApiError> {
|
||||
let config = state.config.load().envelope.config.clone();
|
||||
let sources = tokio::task::spawn_blocking(move || configured_file_log_sources(&config))
|
||||
let observed = state.docker.latest();
|
||||
let sources = tokio::task::spawn_blocking(move || configured_file_log_sources(&config, &observed))
|
||||
.await
|
||||
.map_err(|_| {
|
||||
ApiError(
|
||||
|
||||
@@ -211,10 +211,11 @@ fn validate_file_log_query(query: &FileLogQuery) -> Result<(), ApiError> {
|
||||
/// Runs a stored-log query (blocking file I/O).
|
||||
fn file_log_query_blocking(
|
||||
config: &crate::config::Config,
|
||||
observed: &std::collections::BTreeMap<String, crate::docker::Observation>,
|
||||
query: &FileLogQuery,
|
||||
search: &[FileLogSearchClause],
|
||||
) -> Result<Json<Value>, ApiError> {
|
||||
let mut sources = configured_file_log_sources(config);
|
||||
let mut sources = configured_file_log_sources(config, observed);
|
||||
let log_format = config.logging.format.clone();
|
||||
let requested = query.source.as_deref().unwrap_or("all");
|
||||
let mut truncated = false;
|
||||
@@ -406,7 +407,8 @@ async fn file_logs_query(
|
||||
validate_file_log_query(&query)?;
|
||||
let search = parse_file_log_search(query.q.as_deref().unwrap_or(""))?;
|
||||
let config = state.config.load().envelope.config.clone();
|
||||
tokio::task::spawn_blocking(move || file_log_query_blocking(&config, &query, &search))
|
||||
let observed = state.docker.latest();
|
||||
tokio::task::spawn_blocking(move || file_log_query_blocking(&config, &observed, &query, &search))
|
||||
.await
|
||||
.map_err(|_| {
|
||||
ApiError(
|
||||
|
||||
+21
-1
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.0.3",
|
||||
"info": {
|
||||
"title": "RustProxy Administration API",
|
||||
"version": "0.38.8",
|
||||
"version": "0.41.3",
|
||||
"description": "Administration API for the active panel origin. Sign in through the panel; the same-origin HttpOnly cookie authenticates all private operations. Mutations also require the exact Origin, X-RustProxy-Request: 1 and a session-bound X-CSRF-Token. Loopback HTTP is the default; Settings can enable HTTPS before using a non-loopback administration bind. This document contains no live configuration or credentials. Object schemas marked extensible are summaries: full configuration validation is authoritative in Rust. The API also permits explicitly scoped GeneralApiBearer tokens on a narrow route allowlist, with RO/RW and source CIDR checks; API-token management and Prometheus-token management are browser-session-only."
|
||||
},
|
||||
"servers": [
|
||||
@@ -7060,6 +7060,26 @@
|
||||
"compressed": {
|
||||
"type": "boolean",
|
||||
"description": "True for a rotated gzip source member."
|
||||
},
|
||||
"rotation": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"minimum": 0,
|
||||
"maximum": 4294967295,
|
||||
"description": "0 for current file; positive number for a rotation."
|
||||
},
|
||||
"scope": {
|
||||
"type": "string",
|
||||
"enum": ["vhost", "redirect", "host404", "unmatched", "access", "error"]
|
||||
},
|
||||
"site": {
|
||||
"type": "string",
|
||||
"description": "Configured site ID, or empty for shared sources."
|
||||
},
|
||||
"domains": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" },
|
||||
"description": "Current configured hostnames and aliases for this site, including Docker publications. Empty for shared, unmatched or no longer configured sites. Identical for all rotations."
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -472,10 +472,12 @@ fn builtin_dashboard_presets_are_valid_layouts_with_translations() {
|
||||
dashboard_density: String,
|
||||
overview_samples: u16,
|
||||
widgets: Vec<(String, u8)>,
|
||||
#[serde(default)]
|
||||
dashboard_widget_heights: Option<std::collections::BTreeMap<String, u8>>,
|
||||
}
|
||||
let presets: Vec<BuiltinPreset> =
|
||||
serde_json::from_str(include_str!("web/dashboard-builtin-presets.json")).unwrap();
|
||||
assert!(presets.len() >= 10);
|
||||
assert!(presets.len() >= 18);
|
||||
assert!(presets.iter().any(|preset| preset.form == "mobile"));
|
||||
let mut ids = std::collections::HashSet::new();
|
||||
let languages: Vec<serde_json::Value> = [
|
||||
@@ -500,6 +502,9 @@ fn builtin_dashboard_presets_are_valid_layouts_with_translations() {
|
||||
let visible: Vec<String> = preset.widgets.iter().map(|(id, _)| id.clone()).collect();
|
||||
let unique: std::collections::HashSet<&String> = visible.iter().collect();
|
||||
assert_eq!(unique.len(), visible.len(), "{}", preset.id);
|
||||
if let Some(heights) = &preset.dashboard_widget_heights {
|
||||
assert!(heights.keys().all(|id| visible.contains(id)), "{}", preset.id);
|
||||
}
|
||||
let hidden: Vec<String> = DASHBOARD_WIDGETS
|
||||
.iter()
|
||||
.map(|widget| widget.id.clone())
|
||||
@@ -511,7 +516,7 @@ fn builtin_dashboard_presets_are_valid_layouts_with_translations() {
|
||||
dashboard_widgets: order,
|
||||
dashboard_hidden_widgets: hidden,
|
||||
dashboard_widget_sizes: Some(preset.widgets.iter().cloned().collect()),
|
||||
dashboard_widget_heights: None,
|
||||
dashboard_widget_heights: preset.dashboard_widget_heights.clone(),
|
||||
dashboard_density: preset.dashboard_density.clone(),
|
||||
overview_samples: preset.overview_samples,
|
||||
};
|
||||
|
||||
+82
-6
@@ -3012,7 +3012,7 @@ mod tests {
|
||||
config.logging.file.enabled = false;
|
||||
config.logging.file.per_vhost = false;
|
||||
config.logging.file.path = path.to_string_lossy().into_owned();
|
||||
let sources = configured_file_log_sources(&config);
|
||||
let sources = configured_file_log_sources(&config, &Default::default());
|
||||
let access = sources.iter().find(|source| source.id == "access").unwrap();
|
||||
assert!(!access.enabled);
|
||||
assert!(access.exists);
|
||||
@@ -3020,6 +3020,80 @@ mod tests {
|
||||
assert_eq!(access.path, path);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_log_domains_cover_configured_sites_docker_and_rotations() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let mut config = config::demo_config("127.0.0.1:9000".parse().unwrap());
|
||||
config.vhosts[0].id = "app".into();
|
||||
config.vhosts[0].frontend.hosts = vec!["app.example.test".into(), "*.app.example.test".into()];
|
||||
config.vhosts[0].enabled = false;
|
||||
config.redirects.push(serde_json::from_value(json!({
|
||||
"id": "app", "frontend": {"hosts": ["old.example.test"], "listener_ids": ["http"]}
|
||||
})).unwrap());
|
||||
config.not_found_hosts.push(serde_json::from_value(json!({
|
||||
"id": "app", "frontend": {"hosts": ["park.example.test"], "listener_ids": ["http"]}
|
||||
})).unwrap());
|
||||
config.docker_agents.agents.push(crate::docker::Agent {
|
||||
id: "node1".into(),
|
||||
domains: vec!["example.test".into()],
|
||||
label_publish: true,
|
||||
assignments: vec![crate::docker::Assignment {
|
||||
service_key: "container:manual:80/tcp".into(),
|
||||
hostname: "manual".into(),
|
||||
aliases: vec!["manual-alias".into()],
|
||||
enabled: false,
|
||||
..Default::default()
|
||||
}],
|
||||
..Default::default()
|
||||
});
|
||||
let manual = crate::docker::generated_id("node1", "container:manual:80/tcp");
|
||||
let labelled = crate::docker::generated_id("node1", "container:label:80/tcp");
|
||||
let inventory: crate::docker::Inventory = serde_json::from_value(json!({
|
||||
"agent_version": "test", "hostname": "node1", "observed_at": "now",
|
||||
"services": [{
|
||||
"key": "container:label:80/tcp", "technical_name": "label",
|
||||
"container_id": "test", "container_name": "label", "image": "test",
|
||||
"private_port": 80, "protocol": "tcp",
|
||||
"labels": {"rustproxy.enable": "true", "rustproxy.host": "label", "rustproxy.aliases": "label-alias"}
|
||||
}]
|
||||
})).unwrap();
|
||||
let observed = std::collections::BTreeMap::from([("node1".into(), crate::docker::Observation {
|
||||
agent_id: "node1".into(), ok: true, checked_at_unix_ms: 1,
|
||||
last_ok_unix_ms: Some(1), error: None, inventory: Some(inventory),
|
||||
})]);
|
||||
config.logging.file.per_vhost = true;
|
||||
config.logging.file.directory = dir.path().to_string_lossy().into_owned();
|
||||
config.error_log.path = dir.path().join("error.log").to_string_lossy().into_owned();
|
||||
for name in ["app.jsonl", "app.jsonl.1", "app.redirect.jsonl", "app.host404.jsonl",
|
||||
"deleted.jsonl", "_unmatched.jsonl", &format!("{manual}.jsonl"), &format!("{labelled}.jsonl")] {
|
||||
std::fs::write(dir.path().join(name), records(1, 2).join("\n")).unwrap();
|
||||
}
|
||||
write_gz(&dir.path().join("app.jsonl.2.gz"), &records(1, 2));
|
||||
let sources = configured_file_log_sources(&config, &observed);
|
||||
let domains = |id: &str| sources.iter().find(|s| s.id == id).unwrap().domains.clone();
|
||||
let app_domains = vec!["app.example.test".to_owned(), "*.app.example.test".to_owned()];
|
||||
assert_eq!(domains("vhost:app"), app_domains);
|
||||
assert_eq!(domains("vhost-file:app.jsonl.1"), app_domains);
|
||||
assert_eq!(domains("vhost-gz:app.jsonl.2.gz"), app_domains);
|
||||
assert_eq!(domains("vhost:app.redirect"), vec!["old.example.test"]);
|
||||
assert_eq!(domains("vhost:app.host404"), vec!["park.example.test"]);
|
||||
assert_eq!(domains(&format!("vhost:{manual}")), vec!["manual.example.test", "manual-alias.example.test"]);
|
||||
assert_eq!(domains(&format!("vhost:{labelled}")), vec!["label.example.test", "label-alias.example.test"]);
|
||||
for id in ["vhost:deleted", "vhost:_unmatched", "error"] {
|
||||
assert!(domains(id).is_empty(), "{id}");
|
||||
}
|
||||
let inventory = file_log_sources_json(&sources);
|
||||
let source = inventory.as_array().unwrap().iter().find(|s| s["id"] == "vhost:app").unwrap();
|
||||
assert_eq!(source["domains"], json!(app_domains));
|
||||
let query = FileLogQuery { source: Some("vhost:app".into()), consolidate_vhosts: Some(true), ..Default::default() };
|
||||
let result = file_log_query_blocking(&config, &observed, &query, &[]).unwrap().0;
|
||||
assert_eq!(result["sources"].as_array().unwrap().len(), 3);
|
||||
assert!(result["sources"].as_array().unwrap().iter().all(|s| s["domains"] == json!(app_domains)));
|
||||
config.logging.file.per_vhost = false;
|
||||
config.logging.file.path = dir.path().join("access.jsonl").to_string_lossy().into_owned();
|
||||
assert!(configured_file_log_sources(&config, &observed).iter().all(|s| s.domains.is_empty()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stored_log_tail_enforces_line_budget() {
|
||||
use std::io::Write;
|
||||
@@ -3187,7 +3261,7 @@ mod tests {
|
||||
let mut config = Config::default();
|
||||
config.logging.file.per_vhost = false;
|
||||
config.logging.file.path = active.to_string_lossy().into_owned();
|
||||
let sources = configured_file_log_sources(&config);
|
||||
let sources = configured_file_log_sources(&config, &Default::default());
|
||||
assert!(sources
|
||||
.iter()
|
||||
.any(|item| item.path == rotated && item.compressed));
|
||||
@@ -3209,7 +3283,7 @@ mod tests {
|
||||
let mut config = Config::default();
|
||||
config.logging.file.per_vhost = true;
|
||||
config.logging.file.directory = dir.path().to_string_lossy().into_owned();
|
||||
let sources = configured_file_log_sources(&config);
|
||||
let sources = configured_file_log_sources(&config, &Default::default());
|
||||
let app = sources
|
||||
.iter()
|
||||
.filter(|source| source.group_id == "vhost:app")
|
||||
@@ -3258,7 +3332,7 @@ mod tests {
|
||||
config.logging.file.per_vhost = true;
|
||||
config.logging.file.directory = dir.path().to_string_lossy().into_owned();
|
||||
config.error_log.path = dir.path().join("none/error.log").to_string_lossy().into_owned();
|
||||
let sources = configured_file_log_sources(&config);
|
||||
let sources = configured_file_log_sources(&config, &Default::default());
|
||||
let mail: Vec<_> = sources.iter().filter(|s| s.group_id == "vhost:mail").collect();
|
||||
assert_eq!(
|
||||
mail.iter().map(|s| (s.id.as_str(), s.rotation)).collect::<Vec<_>>(),
|
||||
@@ -3282,7 +3356,7 @@ mod tests {
|
||||
limit: Some(5),
|
||||
..extra
|
||||
};
|
||||
file_log_query_blocking(&config, &query, &[]).unwrap().0
|
||||
file_log_query_blocking(&config, &Default::default(), &query, &[]).unwrap().0
|
||||
};
|
||||
let value = query(FileLogQuery::default());
|
||||
let times: Vec<u64> = value["entries"]
|
||||
@@ -3312,6 +3386,7 @@ mod tests {
|
||||
// A single rotated file is its own source.
|
||||
let value = file_log_query_blocking(
|
||||
&config,
|
||||
&Default::default(),
|
||||
&FileLogQuery {
|
||||
source: Some("vhost-gz:mail.jsonl.10.gz".into()),
|
||||
..FileLogQuery::default()
|
||||
@@ -3334,7 +3409,7 @@ mod tests {
|
||||
let mut config = Config::default();
|
||||
config.logging.file.per_vhost = false;
|
||||
config.logging.file.path = active.to_string_lossy().into_owned();
|
||||
let sources = configured_file_log_sources(&config);
|
||||
let sources = configured_file_log_sources(&config, &Default::default());
|
||||
let access: Vec<_> = sources
|
||||
.iter()
|
||||
.filter(|s| s.group_id == "access")
|
||||
@@ -3350,6 +3425,7 @@ mod tests {
|
||||
);
|
||||
let value = file_log_query_blocking(
|
||||
&config,
|
||||
&Default::default(),
|
||||
&FileLogQuery {
|
||||
source: Some("access".into()),
|
||||
consolidate_vhosts: Some(true),
|
||||
|
||||
@@ -67,7 +67,7 @@ window.rustProxyDashboardLayout = (() => {
|
||||
dashboard_widgets: normalizeDashboardWidgets(visible),
|
||||
dashboard_hidden_widgets: ADMIN_DASHBOARD_WIDGETS.filter(id => !visible.includes(id)),
|
||||
dashboard_widget_sizes: sizes,
|
||||
dashboard_widget_heights: null,
|
||||
dashboard_widget_heights: normalizeDashboardWidgetHeights(preset.dashboard_widget_heights),
|
||||
dashboard_widget_positions: null,
|
||||
dashboard_auto_fit: true,
|
||||
dashboard_density: preset.dashboard_density,
|
||||
|
||||
@@ -567,6 +567,442 @@
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "daily_compact",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinDailyCompact",
|
||||
"description_key": "dashboardBuiltinDailyCompactHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"requests",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
2
|
||||
],
|
||||
[
|
||||
"errors",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cert_expiry",
|
||||
2
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"memory_breakdown",
|
||||
6
|
||||
],
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"websocket",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_backend_active",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cold_storage",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"cache_outcomes",
|
||||
4
|
||||
],
|
||||
[
|
||||
"system_chart",
|
||||
4
|
||||
],
|
||||
[
|
||||
"connection_chart",
|
||||
4
|
||||
],
|
||||
[
|
||||
"wide_cpu",
|
||||
4
|
||||
],
|
||||
[
|
||||
"cache_diagnostics",
|
||||
4
|
||||
],
|
||||
[
|
||||
"network_diagnostics",
|
||||
4
|
||||
],
|
||||
[
|
||||
"process_diagnostics",
|
||||
12
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
],
|
||||
"dashboard_widget_heights": {
|
||||
"traffic_chart": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "latency_triage",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinLatencyTriage",
|
||||
"description_key": "dashboardBuiltinLatencyTriageHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_request_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_queue",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_capacity",
|
||||
2
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_latency",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_requests",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_latency",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_retries",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_http5xx",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_timeouts",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_network",
|
||||
4
|
||||
],
|
||||
[
|
||||
"wide_backend_health",
|
||||
6
|
||||
],
|
||||
[
|
||||
"connection_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
],
|
||||
"dashboard_widget_heights": {
|
||||
"traffic_chart": 7,
|
||||
"wide_latency": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "memory_pressure",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinMemoryPressure",
|
||||
"description_key": "dashboardBuiltinMemoryPressureHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_process_rss",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_process_cpu",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_process_fds",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_open_connections",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"memory_breakdown",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_memory",
|
||||
6
|
||||
],
|
||||
[
|
||||
"extra_cold_storage",
|
||||
4
|
||||
],
|
||||
[
|
||||
"extra_cold_queue_memory",
|
||||
4
|
||||
],
|
||||
[
|
||||
"extra_active_exchanges",
|
||||
4
|
||||
],
|
||||
[
|
||||
"wide_cpu",
|
||||
6
|
||||
],
|
||||
[
|
||||
"system_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"cache_diagnostics",
|
||||
4
|
||||
],
|
||||
[
|
||||
"process_diagnostics",
|
||||
4
|
||||
],
|
||||
[
|
||||
"network_diagnostics",
|
||||
4
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "delivery_efficiency",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinDeliveryEfficiency",
|
||||
"description_key": "dashboardBuiltinDeliveryEfficiencyHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"bandwidth",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_hit_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cache_miss_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_backend_active",
|
||||
2
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_cache_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"cache_outcomes",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_requests",
|
||||
4
|
||||
],
|
||||
[
|
||||
"backend_traffic",
|
||||
4
|
||||
],
|
||||
[
|
||||
"wide_compression_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_transform_activity",
|
||||
6
|
||||
],
|
||||
[
|
||||
"memory_breakdown",
|
||||
6
|
||||
],
|
||||
[
|
||||
"cache_diagnostics",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_cpu",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_latency",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
],
|
||||
"dashboard_widget_heights": {
|
||||
"traffic_chart": 7
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "docker_hosts",
|
||||
"form": "desktop",
|
||||
"name_key": "dashboardBuiltinDockerHosts",
|
||||
"description_key": "dashboardBuiltinDockerHostsHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 600,
|
||||
"widgets": [
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_request_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cert_expiry",
|
||||
2
|
||||
],
|
||||
[
|
||||
"docker_agents",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_apps",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_host_load",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_containers",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_requests",
|
||||
6
|
||||
],
|
||||
[
|
||||
"docker_host_network",
|
||||
6
|
||||
],
|
||||
[
|
||||
"docker_agents_2",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_apps_2",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_host_load_2",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_containers_2",
|
||||
3
|
||||
],
|
||||
[
|
||||
"docker_requests_2",
|
||||
6
|
||||
],
|
||||
[
|
||||
"docker_host_network_2",
|
||||
6
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
6
|
||||
],
|
||||
[
|
||||
"wide_latency",
|
||||
6
|
||||
],
|
||||
[
|
||||
"backend_table",
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "mobile_status",
|
||||
"form": "mobile",
|
||||
@@ -642,5 +1078,51 @@
|
||||
12
|
||||
]
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "mobile_diagnostics",
|
||||
"form": "mobile",
|
||||
"name_key": "dashboardBuiltinMobileDiagnostics",
|
||||
"description_key": "dashboardBuiltinMobileDiagnosticsHelp",
|
||||
"dashboard_density": "compact",
|
||||
"overview_samples": 120,
|
||||
"widgets": [
|
||||
[
|
||||
"extra_total_rps",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_response_latency",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_request_error_rate",
|
||||
2
|
||||
],
|
||||
[
|
||||
"backend_health",
|
||||
2
|
||||
],
|
||||
[
|
||||
"memory",
|
||||
2
|
||||
],
|
||||
[
|
||||
"extra_cert_expiry",
|
||||
2
|
||||
],
|
||||
[
|
||||
"traffic_chart",
|
||||
12
|
||||
],
|
||||
[
|
||||
"backend_tiny",
|
||||
12
|
||||
],
|
||||
[
|
||||
"memory_breakdown",
|
||||
12
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -38,7 +38,8 @@
|
||||
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:/, "");
|
||||
const site = group.site || group.id.replace(/^vhost:/, "");
|
||||
return group.domains.length ? `${site} (${group.domains.join(", ")})` : site;
|
||||
}
|
||||
function fileLabel(source) {
|
||||
const rotation = Number(source.rotation) || 0;
|
||||
@@ -51,7 +52,7 @@
|
||||
for (const source of sources) {
|
||||
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); }
|
||||
if (!group) { group = { id, scope: scopeOf(source), site: source.site || "", domains: Array.isArray(source.domains) ? [...new Set(source.domains.filter(domain => typeof domain === "string" && domain))] : [], 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);
|
||||
}
|
||||
@@ -321,8 +322,9 @@
|
||||
params.set("offset", String(offset)); params.set("limit", String(currentLimit()));
|
||||
return params.toString();
|
||||
}
|
||||
async function refresh(reset = false) {
|
||||
async function refresh(reset = false, reloadInventory = false) {
|
||||
if (!authenticated) return;
|
||||
if (reloadInventory) inventory = null;
|
||||
if (reset) offset = 0;
|
||||
if (busy) { pendingRefresh = true; return; }
|
||||
busy = true; $("file-logs-refresh").disabled = true;
|
||||
@@ -391,7 +393,7 @@
|
||||
});
|
||||
$("file-logs-open").addEventListener("click", () => { $("logs-menu").open = false; setPanel("filelogs"); });
|
||||
$("settings-file-logs-open").addEventListener("click", () => setPanel("filelogs"));
|
||||
$("file-logs-refresh").addEventListener("click", () => refresh(true));
|
||||
$("file-logs-refresh").addEventListener("click", () => refresh(true, true));
|
||||
$("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));
|
||||
@@ -417,5 +419,5 @@
|
||||
$("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(); } });
|
||||
syncColumnPicker(); syncHeaders();
|
||||
window.rustProxyFileLogs = { refresh: () => refresh(false), reset, inventory: loadInventory, applyPreferences };
|
||||
window.rustProxyFileLogs = { refresh: () => refresh(false, true), reset, inventory: loadInventory, applyPreferences };
|
||||
})();
|
||||
Reference in new issue
Block a user