Add debug logging system with full request/response logging and sanitization
- New debug logging system with auto-sanitization of sensitive data (passwords, tokens, JWTs, keys) - Debug mode can be enabled via launcher (option 6) or Server page UI - Debug logs written to logs/debug.log with full HTTP request/response details - Added comprehensive page access logging (overview, players, vehicles, server, director) - Added SSH, K8s, database, and service initialization debug logging - Fixed miner protection console spam (now uses DEBUG level) - Removed admin management section from server page - Updated README with debug mode documentation
This commit is contained in:
1 parent
e977f8cd5b
commit
00288d93a6
12 files changed
+662
-28
No files matched your search
+76
-13
@@ -190,19 +190,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<span>Admin Management</span>
|
||||
<span style="font-size:12px;color:var(--text-muted);">Coming Soon</span>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<p style="font-size:14px;color:var(--text-light);">
|
||||
Server admin assignment and player permission management interface.
|
||||
Requires integration with game server authentication system.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">Pod Status</div>
|
||||
<div class="card-body">
|
||||
@@ -213,6 +200,26 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="cursor:pointer;" onclick="document.getElementById('debug-section').classList.toggle('hidden');">
|
||||
<span>🐛 Debug Logging</span>
|
||||
<span id="debug-status" style="font-size:12px;color:var(--text-muted);">Loading...</span>
|
||||
</div>
|
||||
<div class="card-body" id="debug-section">
|
||||
<div style="margin-bottom:12px;padding:12px;background:#1a1a2e;border-radius:6px;font-size:13px;line-height:1.6;color:#e0d5c7;">
|
||||
<strong style="color:#9b59b6;">📝 Verbose Logging:</strong> Enable to log detailed information about SSH commands, API requests, database queries, and service connections.
|
||||
Logs are written to <code>logs/debug.log</code>. Sanitizes sensitive data (passwords, tokens) automatically.
|
||||
</div>
|
||||
<div style="display:flex;align-items:center;gap:16px;">
|
||||
<label style="display:flex;align-items:center;gap:8px;cursor:pointer;">
|
||||
<input type="checkbox" id="debug-toggle" style="width:18px;height:18px;">
|
||||
<span style="font-size:14px;">Enable debug logging</span>
|
||||
</label>
|
||||
<span id="debug-indicator" style="font-size:12px;color:var(--text-muted);"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header" style="cursor:pointer;" onclick="document.getElementById('miner-section').classList.toggle('hidden');">
|
||||
<span>🔒 Miner Protection</span>
|
||||
@@ -686,5 +693,61 @@ function refreshAuditLogs() {
|
||||
|
||||
// Load audit stats on page load
|
||||
loadAuditLogs();
|
||||
|
||||
// Debug Logging
|
||||
const debugToggle = document.getElementById('debug-toggle');
|
||||
const debugStatus = document.getElementById('debug-status');
|
||||
const debugIndicator = document.getElementById('debug-indicator');
|
||||
|
||||
async function loadDebugStatus() {
|
||||
try {
|
||||
const resp = await csrfFetch('/api/settings');
|
||||
const data = await resp.json();
|
||||
if (data.success) {
|
||||
const debugEnabled = data.settings.logging.debug_enabled;
|
||||
debugToggle.checked = debugEnabled;
|
||||
if (debugEnabled) {
|
||||
debugStatus.innerHTML = '<span style="color:var(--success);">✓ Enabled</span>';
|
||||
debugIndicator.textContent = 'Debug logs writing to logs/debug.log';
|
||||
} else {
|
||||
debugStatus.innerHTML = '<span style="color:var(--text-muted);">○ Disabled</span>';
|
||||
debugIndicator.textContent = '';
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load debug status:', e);
|
||||
}
|
||||
}
|
||||
|
||||
debugToggle.addEventListener('change', async function() {
|
||||
const enabled = this.checked;
|
||||
try {
|
||||
const resp = await csrfFetch('/api/settings/debug', {
|
||||
method: 'POST',
|
||||
body: { enabled: enabled }
|
||||
});
|
||||
const data = await resp.json();
|
||||
if (data.success) {
|
||||
if (enabled) {
|
||||
debugStatus.innerHTML = '<span style="color:var(--success);">✓ Enabled</span>';
|
||||
debugIndicator.textContent = 'Debug logs writing to logs/debug.log';
|
||||
alert('Debug logging enabled! Logs will be written to logs/debug.log');
|
||||
} else {
|
||||
debugStatus.innerHTML = '<span style="color:var(--text-muted);">○ Disabled</span>';
|
||||
debugIndicator.textContent = '';
|
||||
alert('Debug logging disabled.');
|
||||
}
|
||||
} else {
|
||||
alert('Failed to toggle debug: ' + (data.error || 'Unknown error'));
|
||||
this.checked = !enabled;
|
||||
}
|
||||
} catch (e) {
|
||||
alert('Error toggling debug: ' + e.message);
|
||||
this.checked = !enabled;
|
||||
}
|
||||
});
|
||||
|
||||
// Load debug status on page load
|
||||
loadDebugStatus();
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in new issue
Block a user