mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-02-18 16:36:27 +00:00
Update auto_post_install.sh
This commit is contained in:
@@ -550,8 +550,33 @@ export function SystemLogs() {
|
||||
|
||||
if (loading && logs.length === 0 && events.length === 0) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-64">
|
||||
<RefreshCw className="h-8 w-8 animate-spin text-muted-foreground" />
|
||||
<div className="space-y-6">
|
||||
<div className="grid grid-cols-2 lg:grid-cols-4 gap-4 lg:gap-6">
|
||||
{[...Array(4)].map((_, i) => (
|
||||
<Card key={i} className="bg-card border-border animate-pulse">
|
||||
<CardContent className="p-6">
|
||||
<div className="h-4 bg-muted rounded w-1/2 mb-4"></div>
|
||||
<div className="h-8 bg-muted rounded w-3/4 mb-2"></div>
|
||||
<div className="h-3 bg-muted rounded w-2/3"></div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
<Card className="bg-card border-border animate-pulse">
|
||||
<CardContent className="p-6">
|
||||
<div className="h-6 bg-muted rounded w-1/3 mb-6"></div>
|
||||
<div className="h-10 bg-muted rounded w-full mb-4"></div>
|
||||
<div className="space-y-3">
|
||||
{[...Array(8)].map((_, i) => (
|
||||
<div key={i} className="flex gap-3">
|
||||
<div className="h-5 bg-muted rounded w-16"></div>
|
||||
<div className="h-5 bg-muted rounded w-24"></div>
|
||||
<div className="h-5 bg-muted rounded flex-1"></div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -559,11 +584,13 @@ export function SystemLogs() {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{loading && (logs.length > 0 || events.length > 0) && (
|
||||
<div className="fixed inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-4 p-8 rounded-lg bg-card border border-border shadow-lg">
|
||||
<RefreshCw className="h-12 w-12 animate-spin text-primary" />
|
||||
<div className="text-lg font-medium text-foreground">Loading logs selected...</div>
|
||||
<div className="text-sm text-muted-foreground">Please wait while we fetch the logs</div>
|
||||
<div className="fixed inset-0 bg-background/60 backdrop-blur-sm z-50 flex items-center justify-center">
|
||||
<div className="flex flex-col items-center gap-3 p-6 rounded-xl bg-card border border-border shadow-xl">
|
||||
<div className="relative">
|
||||
<div className="h-10 w-10 rounded-full border-2 border-muted"></div>
|
||||
<div className="absolute inset-0 h-10 w-10 rounded-full border-2 border-transparent border-t-primary animate-spin"></div>
|
||||
</div>
|
||||
<div className="text-sm font-medium text-foreground">Loading logs...</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -5160,7 +5160,9 @@ def api_logs():
|
||||
days = int(since_days)
|
||||
# Cap at 90 days to prevent excessive queries
|
||||
days = min(days, 90)
|
||||
cmd = ['journalctl', '--since', f'{days} days ago', '-n', '10000', '--output', 'json', '--no-pager']
|
||||
# No -n limit when using --since: the time range already bounds the query.
|
||||
# A hard -n 10000 was masking differences between date ranges on busy servers.
|
||||
cmd = ['journalctl', '--since', f'{days} days ago', '--output', 'json', '--no-pager']
|
||||
except ValueError:
|
||||
cmd = ['journalctl', '-n', limit, '--output', 'json', '--no-pager']
|
||||
else:
|
||||
@@ -5174,7 +5176,9 @@ def api_logs():
|
||||
# We filter after fetching since journalctl doesn't have a direct SYSLOG_IDENTIFIER flag
|
||||
service_filter = service
|
||||
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
|
||||
# Longer timeout for date-range queries which may return many entries
|
||||
query_timeout = 60 if since_days else 30
|
||||
result = subprocess.run(cmd, capture_output=True, text=True, timeout=query_timeout)
|
||||
|
||||
if result.returncode == 0:
|
||||
logs = []
|
||||
@@ -6720,6 +6724,40 @@ if __name__ == '__main__':
|
||||
cli = sys.modules['flask.cli']
|
||||
cli.show_server_banner = lambda *x: None
|
||||
|
||||
# ── Ensure journald stores info-level messages ──
|
||||
# Proxmox defaults MaxLevelStore=warning which drops info/notice entries.
|
||||
# This causes System Logs to show almost identical counts across date ranges
|
||||
# (since most log activity is info-level and gets silently discarded).
|
||||
# We create a drop-in to raise the level to info so logs are properly stored.
|
||||
try:
|
||||
journald_conf = "/etc/systemd/journald.conf"
|
||||
dropin_dir = "/etc/systemd/journald.conf.d"
|
||||
dropin_file = f"{dropin_dir}/proxmenux-loglevel.conf"
|
||||
|
||||
if os.path.isfile(journald_conf) and not os.path.isfile(dropin_file):
|
||||
# Read current MaxLevelStore
|
||||
current_max = ""
|
||||
with open(journald_conf, 'r') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line.startswith("MaxLevelStore="):
|
||||
current_max = line.split("=", 1)[1].strip().lower()
|
||||
|
||||
restrictive_levels = {"emerg", "alert", "crit", "err", "warning"}
|
||||
if current_max in restrictive_levels:
|
||||
os.makedirs(dropin_dir, exist_ok=True)
|
||||
with open(dropin_file, 'w') as f:
|
||||
f.write("# ProxMenux: Allow info-level messages for proper log display\n")
|
||||
f.write("# Proxmox default MaxLevelStore=warning drops most system logs\n")
|
||||
f.write("[Journal]\n")
|
||||
f.write("MaxLevelStore=info\n")
|
||||
f.write("MaxLevelSyslog=info\n")
|
||||
subprocess.run(["systemctl", "restart", "systemd-journald"],
|
||||
capture_output=True, timeout=10)
|
||||
print("[ProxMenux] Fixed journald MaxLevelStore (was too restrictive for log display)")
|
||||
except Exception as e:
|
||||
print(f"[ProxMenux] journald check skipped: {e}")
|
||||
|
||||
# Check for SSL configuration
|
||||
ssl_ctx = None
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user