Files
bigwo/mcp-server-ssh/check_logs.cjs

13 lines
595 B
JavaScript
Raw Normal View History

const { Client } = require("ssh2");
const c = new Client();
c.on("ready", () => {
// 搜索包含"产品"的日志行,以及 processReply/handoff 相关行
c.exec('tail -50 /var/log/bigwo/server-out.log | grep -E "greeting|upstream|tts_event|assistant|rag|ready|error"', (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" });