From 4df48e8ae682eee819c3dfeb38bac310e7e09bbf Mon Sep 17 00:00:00 2001 From: Weston Blieden Date: Mon, 13 Apr 2026 14:33:16 +0200 Subject: [PATCH] fix: node name, account, version and IP persist after syslog rotation --- aarch64/app/html/index.html | 29 ++++++++++++++++++++++++----- aarch64_ROOT/app/html/index.html | 29 ++++++++++++++++++++++++----- aarch64_custom/app/html/index.html | 29 ++++++++++++++++++++++++----- arm/app/html/index.html | 29 ++++++++++++++++++++++++----- arm_ROOT/app/html/index.html | 29 ++++++++++++++++++++++++----- arm_custom/app/html/index.html | 29 ++++++++++++++++++++++++----- 6 files changed, 144 insertions(+), 30 deletions(-) diff --git a/aarch64/app/html/index.html b/aarch64/app/html/index.html index 1fad3ab..85545be 100644 --- a/aarch64/app/html/index.html +++ b/aarch64/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version); diff --git a/aarch64_ROOT/app/html/index.html b/aarch64_ROOT/app/html/index.html index dc5174d..e84d4ea 100644 --- a/aarch64_ROOT/app/html/index.html +++ b/aarch64_ROOT/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version); diff --git a/aarch64_custom/app/html/index.html b/aarch64_custom/app/html/index.html index 113c06d..c3415a0 100644 --- a/aarch64_custom/app/html/index.html +++ b/aarch64_custom/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version); diff --git a/arm/app/html/index.html b/arm/app/html/index.html index dc5174d..e84d4ea 100644 --- a/arm/app/html/index.html +++ b/arm/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version); diff --git a/arm_ROOT/app/html/index.html b/arm_ROOT/app/html/index.html index dc5174d..e84d4ea 100644 --- a/arm_ROOT/app/html/index.html +++ b/arm_ROOT/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version); diff --git a/arm_custom/app/html/index.html b/arm_custom/app/html/index.html index 113c06d..c3415a0 100644 --- a/arm_custom/app/html/index.html +++ b/arm_custom/app/html/index.html @@ -439,6 +439,10 @@ var m = last.match(/http:\/\/(100\.[\d.]+):/); if (m) tsIP = m[1]; } + if (!tsIP) { + var nmSelf = txt.match(/netmap: self:[^\n]*\[(100\.[\d.]+)\//); + if (nmSelf) tsIP = nmSelf[1]; + } if (!tsIP) { var allIPs = txt.match(/\b100\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g) || []; tsIP = allIPs.length ? allIPs[allIPs.length - 1] : null; @@ -452,11 +456,9 @@ if (nm) node = nm[1]; } if (!node) { - var hostMatches = txt.match(/^\S+\s+(\S+)\s+\[\s*INFO/gm); - if (hostMatches) { - var hm = hostMatches[hostMatches.length - 1].match(/^\S+\s+(\S+)/); - if (hm) node = hm[1]; - } + // Extract hostname from Axis syslog format: "2026-01-01T...+00:00 Hostname [ NOTICE ]" + var hostLine = txt.match(/\d{4}-\d{2}-\d{2}T[\d:.]+[+-]\d{2}:\d{2}\s+(\S+)\s+\[/); + if (hostLine) node = hostLine[1]; } var loginMatches = txt.match(/active login:\s+\S+/g); @@ -465,6 +467,14 @@ var lm = loginMatches[loginMatches.length - 1].match(/active login:\s+(\S+)/); if (lm) tailnet = lm[1]; } + if (!tailnet) { + // Fallback: extract from periodic netmap lines "u=user@email.com" + var userMatches = txt.match(/\bu=([^\s\[,\]]+)/g); + if (userMatches) { + var um = userMatches[userMatches.length - 1].match(/u=([^\s\[,\]]+)/); + if (um) tailnet = um[1]; + } + } var versionMatches = txt.match(/Program starting: v(\d+\.\d+\.\d+)/g); var version = null; @@ -473,6 +483,15 @@ var vm = last.match(/v(\d+\.\d+\.\d+)/); if (vm) version = vm[1]; } + if (!version) { + // Fallback: extract from periodic "v1.2.3-tXXX-gYYY peers:" log lines + var peersMatches = txt.match(/v(\d+\.\d+\.\d+)-\S+\s+peers:/g); + if (peersMatches) { + var lp = peersMatches[peersMatches.length - 1]; + var pm = lp.match(/v(\d+\.\d+\.\d+)/); + if (pm) version = pm[1]; + } + } // Cache when found, restore from cache when missing cacheSet('ip', tsIP); cacheSet('node', node); cacheSet('tailnet', tailnet); cacheSet('version', version);