logdoctor-cli
v0.1.0
Published
Privacy-first AI log analysis in your terminal.
Maintainers
Readme
🩺 LogDoctor
LogDoctor is an open-source, privacy-first CLI tool that diagnoses production logs and explains incidents instantly right in your terminal.
💡 Pipe logs → Scrub PII Locally → Get Root Cause Analysis.
🔗 GitHub Repository: https://github.com/shivamshashank/logdoctor
✨ What LogDoctor Does
LogDoctor analyzes application logs using AI to produce clear incident reports directly in your terminal. It focuses on three core pillars:
- Local Data Sanitization (Privacy First)
- Multi-Model AI Diagnosis
- Developer-Native Workflow
Demo
🧠 Features
1. 🛡️ Local Data Sanitization (Privacy First)
Regular expressions and heuristic scanners automatically strip Emails, IP addresses, JWTs, AWS Keys, and application secrets (passwords, auth tokens) locally. [email protected] becomes [REDACTED_EMAIL]. Your sensitive data never leaves your machine.
2. 🤖 Multi-Model AI Diagnosis
Bring your own key (BYOK). Choose your preferred AI engine—OpenAI, Gemini, or Claude—to pinpoint the root cause of the error and generate a suggested code fix.
3. 💻 Developer-Native Workflow
No context switching. Pipe messy, large log files directly into the CLI (e.g., cat error.log | logdoctor analyze) and get color-coded, formatted explanations directly in the terminal where you debug.
4. 📴 100% Offline Mode (Ollama Support)
For absolute zero-trust environments, LogDoctor integrates directly with Ollama. Analyze logs and generate fixes using local LLMs (like llama3 or mistral) without a single byte of data leaving your machine.
5. 📎 Context-Aware Debugging
Provide source code files alongside your logs using the -c flag. LogDoctor will inject your codebase context into the prompt, resulting in hyper-accurate, project-specific code fixes.
6. 📜 Native JSON Log Support
Automatically detects, un-stringifies, and beautifully formats nested JSON logs (like Pino or Winston) so the AI can read them accurately without choking on escaped characters.
🧰 Tech Stack
- Language: Node.js / TypeScript
- CLI Framework:
commander - Terminal UI:
chalk(colors),ora(spinners),marked-terminal(Markdown rendering) - AI SDKs:
@google/generative-ai,openai,@anthropic-ai/sdk
⚙️ Installation
Requires Node.js v18+.
Option 1: Quick Install (macOS / Linux)
You can install LogDoctor instantly using our install script:
curl -fsSL https://raw.githubusercontent.com/shivamshashank/logdoctor/main/install.sh | bashWindows (PowerShell)
npm install -g logdoctor-cli🚀 Quick Start
# Configure your AI provider and API key
logdoctor config
# Analyze a log file
logdoctor analyze error.log
# Or pipe a file
cat error.log | logdoctor analyze
# Analyze with custom instructions and save output to a file
logdoctor analyze error.log -p "Focus on database connection errors" -o report.md
# Attach source code context to help the AI fix the error
logdoctor analyze error.log -c src/database.js
# View the exact prompts being sent to the AI (Verbose mode)
logdoctor analyze error.log --verbose
# Clear your stored configuration (log out)
logdoctor logout⚙️ Run Locally (for Development)
Clone the repository:
git clone https://github.com/shivamshashank/logdoctor cd logdoctorInstall dependencies:
npm installLink the CLI: This command makes
logdoctoravailable globally on your machine, pointing to your local source code.npm linkRun the tool: Now you can run the
logdoctorcommand from any directory. Any changes you make to the code will be reflected immediately.# Configure your API key logdoctor config # Clear your stored configuration (log out) logdoctor logout # Analyze a log file logdoctor analyze examples/node-error.log # Or pipe a file to the command cat examples/pii-data.txt | logdoctor analyze # Analyze with custom instructions and save the output logdoctor analyze examples/node-error.log --prompt "Explain it to a junior dev" --output report.md
🤝 Contributing
Contributions are welcome.
You can help by:
• improving log parsers • adding new integrations • improving AI prompts • fixing bugs
Please open issues or pull requests.
👨💻 Author
Shivam Shashank
📧 Email: [email protected]
🔗 LinkedIn: https://www.linkedin.com/in/shivam-shashank-2b5766217/
⭐ Support the Project
If you find LogDoctor useful, please give the repository a star ⭐ on GitHub.
It helps the project reach more developers.
👉 https://github.com/shivamshashank/logdoctor
