From 4228177920dc114c1f1b2bfec0000d6257b81312 Mon Sep 17 00:00:00 2001 From: MacRimi Date: Fri, 13 Feb 2026 18:21:28 +0100 Subject: [PATCH] Update auto_post_install.sh --- AppImage/components/system-logs.tsx | 41 +++++++++++++++++++++++----- AppImage/scripts/flask_server.py | 42 +++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 9 deletions(-) diff --git a/AppImage/components/system-logs.tsx b/AppImage/components/system-logs.tsx index ce3f308e..41621522 100644 --- a/AppImage/components/system-logs.tsx +++ b/AppImage/components/system-logs.tsx @@ -550,8 +550,33 @@ export function SystemLogs() { if (loading && logs.length === 0 && events.length === 0) { return ( -
- +
+
+ {[...Array(4)].map((_, i) => ( + + +
+
+
+
+
+ ))} +
+ + +
+
+
+ {[...Array(8)].map((_, i) => ( +
+
+
+
+
+ ))} +
+
+
) } @@ -559,11 +584,13 @@ export function SystemLogs() { return (
{loading && (logs.length > 0 || events.length > 0) && ( -
-
- -
Loading logs selected...
-
Please wait while we fetch the logs
+
+
+
+
+
+
+
Loading logs...
)} diff --git a/AppImage/scripts/flask_server.py b/AppImage/scripts/flask_server.py index abde8d9c..93bf0ece 100644 --- a/AppImage/scripts/flask_server.py +++ b/AppImage/scripts/flask_server.py @@ -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: