const { Client } = require('ssh2'); const c = new Client(); c.on('ready', () => { // Get the last session's full greeting timeline + audio forwarding evidence const cmd = [ "echo '=== GREETING LOGS ==='", "grep -E 'sendGreeting|replayGreeting|sendSpeechText|tts_event|tts_reset|audio block|upstream ready' /var/log/bigwo/server-out.log | tail -30", "echo ''", "echo '=== LAST SESSION FULL LOG (first 40 lines) ==='", "LAST_SID=$(grep 'upstream ready' /var/log/bigwo/server-out.log | tail -1 | grep -oP 'session=\\K[^ ]+')", "echo \"Session: $LAST_SID\"", "grep \"$LAST_SID\" /var/log/bigwo/server-out.log | head -40", ].join(' && '); c.exec(cmd, (err, s) => { if (err) { console.error(err); c.end(); return; } let o = ''; s.on('data', (d) => (o += d)); s.stderr.on('data', (d) => (o += d)); s.on('close', () => { console.log(o); c.end(); }); }); }).connect({ host: '119.45.10.34', port: 22, username: 'root', password: '#xyzh%CS#2512@28' });