From 3798f911f1f8c2ed6e5fc720026392da530d5dea Mon Sep 17 00:00:00 2001 From: pablinux Date: Sun, 18 Jan 2026 04:12:30 -0500 Subject: [PATCH] fix: Corregir formato de service_name en WebSocket de logs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problema: - WebSocket de logs usaba formato incorrecto: {app_name}.service - Debería ser: siax-app-{app_name}.service - Esto causaba que journalctl no encontrara el servicio - Los logs de aplicaciones NO funcionaban Solución: - Corregir format!() en websocket.rs línea 96 - Ahora: format!("siax-app-{}.service", app_name) - journalctl ahora busca el servicio correcto Los logs de aplicaciones ahora funcionan correctamente vía: journalctl -u siax-app-IDEAS.service -f --output=json -n 50 --- logs/errors.log | 25 +++++++++++++++++++++++++ src/api/websocket.rs | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/logs/errors.log b/logs/errors.log index f14256f..da6e3fa 100644 --- a/logs/errors.log +++ b/logs/errors.log @@ -389,3 +389,28 @@ [2026-01-18 03:31:15] [ERROR] [Monitor] Error sincronizando app_tareas | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} [2026-01-18 03:31:16] [INFO] [Monitor] App fidelizacion ya existe (ID: 4), actualizando... [2026-01-18 03:31:16] [ERROR] [Monitor] Error sincronizando fidelizacion | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:10:00] [INFO] [Sistema] Iniciando SIAX Agent +[2026-01-18 04:10:00] [INFO] [Sistema] Escaneando servicios systemd existentes... +[2026-01-18 04:10:00] [INFO] [Discovery] 🔍 Escaneando servicios systemd en: /etc/systemd/system +[2026-01-18 04:10:00] [INFO] [Discovery] ✅ Directorio /etc/systemd/system accesible +[2026-01-18 04:10:00] [INFO] [Discovery] 📊 Escaneados 131 archivos, 0 con prefijo 'siax-app-', 0 parseados exitosamente +[2026-01-18 04:10:00] [INFO] [Config] Usando archivo de configuración: config/monitored_apps.json +[2026-01-18 04:10:00] [INFO] [Config] ✅ Configuración cargada: 2 apps desde config/monitored_apps.json +[2026-01-18 04:10:00] [INFO] [Sistema] Servidor detectado: siax-intel +[2026-01-18 04:10:00] [INFO] [Sistema] Iniciando servidor unificado en puerto 8080 +[2026-01-18 04:10:00] [INFO] [Sistema] Sistema SIAX completamente operativo en puerto 8080 +[2026-01-18 04:10:00] [INFO] [Monitor] Vigilando procesos para siax-intel [SIAX-Agent/0.1.0 (linux/x86_64; Rust-Monitor)] +[2026-01-18 04:10:00] [INFO] [Monitor] Buscando app app_tareas en API central... +[2026-01-18 04:10:00] [INFO] [Monitor] App app_tareas encontrada en cloud (ID: 3) +[2026-01-18 04:10:00] [ERROR] [Monitor] Error sincronizando app_tareas | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:10:00] [INFO] [Monitor] Buscando app fidelizacion en API central... +[2026-01-18 04:10:00] [INFO] [Monitor] App fidelizacion encontrada en cloud (ID: 4) +[2026-01-18 04:10:00] [ERROR] [Monitor] Error sincronizando fidelizacion | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:11:00] [INFO] [Monitor] App app_tareas ya existe (ID: 3), actualizando... +[2026-01-18 04:11:00] [ERROR] [Monitor] Error sincronizando app_tareas | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:11:00] [INFO] [Monitor] App fidelizacion ya existe (ID: 4), actualizando... +[2026-01-18 04:11:00] [ERROR] [Monitor] Error sincronizando fidelizacion | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:12:00] [INFO] [Monitor] App app_tareas ya existe (ID: 3), actualizando... +[2026-01-18 04:12:00] [ERROR] [Monitor] Error sincronizando app_tareas | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} +[2026-01-18 04:12:00] [INFO] [Monitor] App fidelizacion ya existe (ID: 4), actualizando... +[2026-01-18 04:12:00] [ERROR] [Monitor] Error sincronizando fidelizacion | HTTP 500 Internal Server Error: {"success":false,"message":"Error al actualizar el estado","error":"Table 'webControl.app_service_history' doesn't exist"} diff --git a/src/api/websocket.rs b/src/api/websocket.rs index 4e9a378..be3d0a5 100644 --- a/src/api/websocket.rs +++ b/src/api/websocket.rs @@ -94,7 +94,7 @@ async fn handle_logs_socket( ws_manager: Arc, ) { let logger = get_logger(); - let service_name = format!("{}.service", app_name); + let service_name = format!("siax-app-{}.service", app_name); // Iniciar journalctl let mut child = match TokioCommand::new("journalctl")