Files
bigwo/mcp-server-ssh/check_fc_logs.js
2026-03-12 12:47:56 +08:00

26 lines
977 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const { Client } = require('ssh2');
const conn = new Client();
const config = {
host: 'demo.tensorgrove.com.cn',
port: 22,
username: 'root',
privateKey: require('fs').readFileSync(require('path').join(require('os').homedir(), '.ssh', 'id_rsa')),
};
conn.on('ready', () => {
// 搜索最近的 FC 回调日志过去5分钟的所有 FC 相关日志)
const cmd = `grep -E '\\[FC\\]|\\[ToolExecutor\\]|room_980c6671|ExternalTextToSpeech|Command:function|TTS segment|Split into|Knowledge base|Promise|parallel' /var/log/bigwo/server-out.log | tail -80`;
conn.exec(cmd, (err, stream) => {
if (err) { console.error('exec error:', err); conn.end(); return; }
let out = '';
stream.on('data', d => out += d.toString());
stream.stderr.on('data', d => process.stderr.write(d));
stream.on('close', () => {
console.log(out);
conn.end();
});
});
}).on('error', err => {
console.error('SSH error:', err.message);
}).connect(config);