Flex Coder: post #1575 — TG.ME

🗜️ Instant Production Crash Log Triage and Extraction in Telegram

When production throws an unexpected 500 error while you are away from your desk, tethering a laptop or fighting with mobile SSH clients is pure agony. We hooked our internal server metrics and diagnostics router right into FlexGram so on-call engineers can inspect real-time log snippets or request full zipped log dumps on the go. The bot triggers non-blocking server actions, pulls crash dumps across internal endpoints with HTTP, and delivers downloadable bundles straight to the chat while recording an audit record in Firebase.

📁 Filename: tail.js
👨‍💻 Code:
sendChatAction("typing");
const target = params || "backend";
const res = await HTTP.get({
url: `https://ops.internal-infra.net/logs/tail?service=${target}`
});
if (!res || !res.logs) {
sendMessage(` Unable to fetch tail output for <b>${target}</b>.`);
return;
}
sendMessage(`📋 <b>Tail output: ${target}</b>\n<pre>${res.logs}</pre>`);


📁 Filename: logs.js
👨‍💻 Code:
sendChatAction("upload_document");
const target = params || "backend";
const res = await HTTP.post({
url: "https://ops.internal-infra.net/logs/archive",
body: { service: target, requested_by: user.username || user.id }
});
if (!res || !res.file_url) {
sendMessage(` Archive generation failed for <b>${target}</b>.`);
return;
}
pushDB("audit/log_requests", { user_id: user.id, service: target, date: Date.now() });
sendDocument(res.file_url, {
caption: `🗜️ <b>Diagnostic dump:</b> <code>${target}</code>`
});


💡 Calling sendChatAction("upload_document") keeps the Telegram status bar active for your users while heavy server archives are building in the background.

⚠️ Note: Protect sensitive internal endpoints by ensuring your bot server's outbound IP is allowlisted on your private network firewall.


#FlexGram
😍1
August 19, 2026 107