Fix empty syslog: pipe tailscaled output via --verbose=1 to logger, add app list API fallback to all variants

This commit is contained in:
Weston Blieden
2026-04-11 20:59:35 +02:00
parent 6ba1c1a1a1
commit a4deaeacae
12 changed files with 179 additions and 16 deletions
+3 -2
View File
@@ -17,13 +17,14 @@ logger -t "Tailscale_VPN" "Starting tailscaled daemon (userspace networking)"
--state="$STATE_DIR/tailscaled.state" \
--socket="$STATE_DIR/tailscaled.sock" \
--socks5-server=localhost:1055 \
--tun=userspace-networking &
--tun=userspace-networking \
--verbose=1 2>&1 | logger -t "Tailscale_VPN" &
TAILSCALED_PID=$!
sleep 2
logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)"
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up 2>&1 | logger -t "Tailscale_VPN"
logger -t "Tailscale_VPN" "Tailscale VPN is running"
wait $TAILSCALED_PID
+28 -1
View File
@@ -566,12 +566,39 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
// Syslog may be empty/rotated - check app status API
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+3 -2
View File
@@ -15,13 +15,14 @@ killall tailscaled 2>/dev/null || true
logger -t "Tailscale_VPN" "Starting tailscaled daemon"
"$APP_DIR/lib/tailscaled" \
--state="$STATE_DIR/tailscaled.state" \
--socket="$STATE_DIR/tailscaled.sock" &
--socket="$STATE_DIR/tailscaled.sock" \
--verbose=1 2>&1 | logger -t "Tailscale_VPN" &
TAILSCALED_PID=$!
sleep 2
logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)"
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes 2>&1 | logger -t "Tailscale_VPN"
logger -t "Tailscale_VPN" "Tailscale VPN is running"
wait $TAILSCALED_PID
+27 -1
View File
@@ -566,12 +566,38 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+27 -1
View File
@@ -566,12 +566,38 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+2 -1
View File
@@ -42,7 +42,8 @@ $TAILSCALED_PATH \
--state="$STATE_DIR/tailscaled.state" \
--socket=$SOCKET_PATH \
--socks5-server=localhost:1055 \
--tun=userspace-networking &
--tun=userspace-networking \
--verbose=1 2>&1 | logger -t "tailscale_script" &
TAILSCALED_PID=$!
# Wait for tailscaled to initialize
+3 -2
View File
@@ -17,13 +17,14 @@ logger -t "Tailscale_VPN" "Starting tailscaled daemon (userspace networking)"
--state="$STATE_DIR/tailscaled.state" \
--socket="$STATE_DIR/tailscaled.sock" \
--socks5-server=localhost:1055 \
--tun=userspace-networking &
--tun=userspace-networking \
--verbose=1 2>&1 | logger -t "Tailscale_VPN" &
TAILSCALED_PID=$!
sleep 2
logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)"
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up 2>&1 | logger -t "Tailscale_VPN"
logger -t "Tailscale_VPN" "Tailscale VPN is running"
wait $TAILSCALED_PID
+27 -1
View File
@@ -566,12 +566,38 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+3 -2
View File
@@ -15,13 +15,14 @@ killall tailscaled 2>/dev/null || true
logger -t "Tailscale_VPN" "Starting tailscaled daemon"
"$APP_DIR/lib/tailscaled" \
--state="$STATE_DIR/tailscaled.state" \
--socket="$STATE_DIR/tailscaled.sock" &
--socket="$STATE_DIR/tailscaled.sock" \
--verbose=1 2>&1 | logger -t "Tailscale_VPN" &
TAILSCALED_PID=$!
sleep 2
logger -t "Tailscale_VPN" "Connecting to Tailscale network (scroll to bottom for auth URL if prompted)"
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes
"$APP_DIR/lib/tailscale" --socket="$STATE_DIR/tailscaled.sock" up --accept-routes 2>&1 | logger -t "Tailscale_VPN"
logger -t "Tailscale_VPN" "Tailscale VPN is running"
wait $TAILSCALED_PID
+27 -1
View File
@@ -566,12 +566,38 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+27 -1
View File
@@ -566,12 +566,38 @@
('0'+now.getHours()).slice(-2) + ':' + ('0'+now.getMinutes()).slice(-2) + ':' + ('0'+now.getSeconds()).slice(-2);
}
var APP_LIST_URL = '/axis-cgi/applications/list.cgi';
function checkAppRunning() {
return fetch(APP_LIST_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(xml) {
var m = xml.match(new RegExp('Name="' + APP + '"[^/]*Status="([^"]+)"'));
return m && m[1] === 'Running';
})
.catch(function() { return false; });
}
function refresh() {
fetch(LOG_URL, { cache: 'no-store', credentials: 'same-origin' })
.then(function(r) { return r.text(); })
.then(function(txt) {
render(parse(txt));
var result = parse(txt);
renderLogs(txt);
if (result.state !== 'disconnected') {
render(result);
} else {
checkAppRunning().then(function(running) {
if (running) {
result.state = 'connected';
result.ip = result.ip || cacheGet('ip');
result.node = result.node || cacheGet('node');
result.tailnet = result.tailnet || cacheGet('tailnet');
result.version = result.version || cacheGet('version');
}
render(result);
});
}
})
.catch(function() {
document.getElementById('status-text').textContent = 'Unable to fetch logs';
+2 -1
View File
@@ -42,7 +42,8 @@ $TAILSCALED_PATH \
--state="$STATE_DIR/tailscaled.state" \
--socket=$SOCKET_PATH \
--socks5-server=localhost:1055 \
--tun=userspace-networking &
--tun=userspace-networking \
--verbose=1 2>&1 | logger -t "tailscale_script" &
TAILSCALED_PID=$!
# Wait for tailscaled to initialize