{"id":30020616,"url":"https://github.com/greenblade29/loglense","last_synced_at":"2026-04-12T07:33:07.890Z","repository":{"id":306759400,"uuid":"1027131730","full_name":"greenblade29/LogLense","owner":"greenblade29","description":"AI-Powered Log Analysis for the Command Line","archived":false,"fork":false,"pushed_at":"2025-07-27T12:42:11.000Z","size":4716,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-06T02:21:01.618Z","etag":null,"topics":["ai-analysis","ai-powered","anthropic","artificial-intelligence","cli-tool","debugging","devops","gemini","llm","log-analysis","machine-learning","ollama","openai","python","root-cause-analysis","sre","troubleshooting"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greenblade29.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-27T11:35:37.000Z","updated_at":"2025-07-28T12:29:24.000Z","dependencies_parsed_at":"2025-07-27T13:37:35.009Z","dependency_job_id":null,"html_url":"https://github.com/greenblade29/LogLense","commit_stats":null,"previous_names":["greenblade29/loglense"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/greenblade29/LogLense","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenblade29%2FLogLense","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenblade29%2FLogLense/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenblade29%2FLogLense/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenblade29%2FLogLense/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greenblade29","download_url":"https://codeload.github.com/greenblade29/LogLense/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenblade29%2FLogLense/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279008289,"owners_count":26084431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai-analysis","ai-powered","anthropic","artificial-intelligence","cli-tool","debugging","devops","gemini","llm","log-analysis","machine-learning","ollama","openai","python","root-cause-analysis","sre","troubleshooting"],"created_at":"2025-08-06T02:02:29.552Z","updated_at":"2025-10-11T18:33:59.945Z","avatar_url":"https://github.com/greenblade29.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🔍 LogLense\n\n### *AI-Powered Log Analysis for the Command Line*\n\n[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/loglense.svg)](https://pypi.org/project/loglense/)\n[![Downloads](https://img.shields.io/pypi/dm/loglense)](https://pypi.org/project/loglense/)\n\n*Transform cryptic log files into actionable insights with the power of AI*\n\n[🚀 Quick Start](#-quick-start) • [📖 Documentation](#-usage) • [🤖 Models](#-supported-models) • [🛠️ Contributing](#-contributing)\n\n\u003c/div\u003e\n\n![LogLense](images/LogLense.png)\n\n---\n\n## ✨ Features\n\n- **AI-powered error analysis** - Get root cause analysis and actionable insights, on the fly\n- **Multiple AI providers** - OpenAI, Anthropic, Google, local models via Ollama\n- **Smart caching** - Avoid redundant API calls for similar logs\n- **Works with any log source** - Pipes, files, Docker, Kubernetes, journalctl\n\n---\n\n## 🚀 Quick Start\n\n### Installation\n\n```bash\npip install loglense\n```\n\n### Basic Usage\n\n```bash\n# Analyze logs from any source\ntail -f /var/log/app.log | loglense analyze\n\n# Use with Docker logs\ndocker logs container_name | loglense analyze\n\n# Analyze with specific model\nkubectl logs pod-name | loglense analyze --model claude-sonnet\n\n# Use local models\njournalctl -u nginx | loglense analyze --model ollama-llama3\n```\n\n### First Time Setup\n\n```bash\n# Interactive configuration\nloglense configure\n\n# View available models\nloglense list-available-models\n\n# Check your configuration\nloglense show-config\n```\n\n---\n\n## 📖 Usage\n\n### Core Commands\n\n#### `loglense analyze`\nThe main command for log analysis. Reads from stdin and provides AI-powered insights.\n\n```bash\n# Basic analysis\ncat error.log | loglense analyze\n\n# Specify model\ntail -100 app.log | loglense analyze --model gpt-4o\n\n# Use custom API endpoint\ncat debug.log | loglense analyze --api-base http://localhost:8000/v1 --model custom-model\n\n# Skip cache\ndocker logs app | loglense analyze --no-cache\n```\n\n**Options:**\n- `--model, -m`: Choose specific model (see [supported models](#-supported-models))\n- `--api-base`: Custom API endpoint for OpenAI-compatible services\n- `--no-cache`: Bypass cache for fresh analysis\n\n#### `loglense configure`\nInteractive setup for default model and API keys.\n\n```bash\nloglense configure\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e📸 Configuration Preview\u003c/summary\u003e\n\n```\n🔧 LogLense Configuration\n\nSelect Default Model\n\n#    Provider     Model           Description\n1    OpenAI       gpt-4o          GPT-4 Optimized - Latest multimodal model\n2    OpenAI       gpt-4o-mini     Smaller, faster GPT-4 for simple tasks\n3    Anthropic    opus-4          Anthropic's state-of-the-art flagship model\n4    Anthropic    sonnet-4        Balanced model with superior performance\n...\n\nSelect default model [2]: 1\n✅ Default model set to: gpt-4o\n\nAPI Key Configuration\nThis model requires: OPENAI_API_KEY\n\nEnter your OPENAI_API_KEY: ••••••••••••••••\n✅ API key saved for OPENAI_API_KEY\n```\n\n\u003c/details\u003e\n\n#### Cache Management\n\n```bash\n# View cache location and size\nloglense cache path\nloglense cache size\n\n# Clear cache\nloglense cache clear\n```\n\n---\n\n## 🤖 Supported Models\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth\u003eProvider\u003c/th\u003e\n\u003cth\u003eModel Alias\u003c/th\u003e\n\u003cth\u003eFull ID\u003c/th\u003e\n\u003cth\u003eBest For\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"2\"\u003e\u003cstrong\u003eOpenAI\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egpt-4o\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eopenai/gpt-4o\u003c/td\u003e\n\u003ctd\u003eComplex log analysis, multi-step reasoning\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003egpt-4o-mini\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eopenai/gpt-4o-mini\u003c/td\u003e\n\u003ctd\u003eFast analysis, simple error detection\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"3\"\u003e\u003cstrong\u003eAnthropic\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eopus-4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eanthropic/claude-opus-4-0\u003c/td\u003e\n\u003ctd\u003eFlagship model, comprehensive analysis\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003esonnet-4\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eanthropic/claude-sonnet-4-0\u003c/td\u003e\n\u003ctd\u003eBalanced performance and speed\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003esonnet-3.7\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eanthropic/claude-3-7-sonnet\u003c/td\u003e\n\u003ctd\u003eAdvanced log pattern recognition\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"2\"\u003e\u003cstrong\u003eGoogle\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003egemini-flash\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003egemini/gemini-2.0-flash\u003c/td\u003e\n\u003ctd\u003eUltra-fast processing\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003egemini-pro\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003egemini/gemini-2.5-pro\u003c/td\u003e\n\u003ctd\u003eAdvanced reasoning capabilities\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"2\"\u003e\u003cstrong\u003eLocal\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003eollama-llama3\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eollama/llama3\u003c/td\u003e\n\u003ctd\u003ePrivacy-focused, offline analysis\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003eollama-gemma\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003eollama/gemma\u003c/td\u003e\n\u003ctd\u003eLightweight local processing\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd rowspan=\"2\"\u003e\u003cstrong\u003eOther\u003c/strong\u003e\u003c/td\u003e\n\u003ctd\u003e\u003ccode\u003emistral-large\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003emistral/mistral-large-latest\u003c/td\u003e\n\u003ctd\u003eEuropean AI, GDPR compliant\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003ccode\u003edeepseek-chat\u003c/code\u003e\u003c/td\u003e\n\u003ctd\u003edeepseek/deepseek-chat\u003c/td\u003e\n\u003ctd\u003eCost-effective analysis\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n### API Key Requirements\n\n| Provider | Environment Variable | How to Get |\n|----------|---------------------|------------|\n| OpenAI | `OPENAI_API_KEY` | [platform.openai.com](https://platform.openai.com/api-keys) |\n| Anthropic | `ANTHROPIC_API_KEY` | [console.anthropic.com](https://console.anthropic.com/) |\n| Google | `GEMINI_API_KEY` | [aistudio.google.com](https://aistudio.google.com/app/apikey) |\n| Mistral | `MISTRAL_API_KEY` | [console.mistral.ai](https://console.mistral.ai/) |\n| DeepSeek | `DEEPSEEK_API_KEY` | [platform.deepseek.com](https://platform.deepseek.com/) |\n| Ollama | None | [Install locally](https://ollama.ai/) |\n\n---\n\n## 🎯 Real-World Examples\n\n### Web Server Error Analysis\n\n```bash\ntail -1000 /var/log/nginx/error.log | loglense analyze\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e📊 Sample Output\u003c/summary\u003e\n\n```markdown\n🤖 LogLense AI Analysis\n\n## Likely Root Cause:\nDatabase connection pool exhaustion causing cascading failures in the web application.\n\n## Sequence of Events:\n1. **14:23:15** - Initial database timeout errors begin\n2. **14:23:45** - Connection pool reaches maximum capacity (500 connections)\n3. **14:24:00** - Application starts rejecting new requests\n4. **14:24:30** - Load balancer begins failing health checks\n\n## Recommended Next Steps:\n1. **Immediate**: Restart the database connection pool service\n2. **Short-term**: Increase connection pool size from 500 to 750\n3. **Long-term**: Implement connection pooling monitoring and alerts\n```\n\n\u003c/details\u003e\n\n### Kubernetes Pod Debugging\n\n```bash\nkubectl logs deployment/api-server --tail=500 | loglense analyze --model claude-sonnet\n```\n\n### Docker Container Analysis\n\n```bash\ndocker logs --since=1h webapp-container | loglense analyze --model gemini-pro\n```\n\n### Application Performance Issues\n\n```bash\njournalctl -u myapp --since=\"1 hour ago\" | loglense analyze --model gpt-4o\n```\n\n---\n\n## 🏗️ Architecture\n\n```mermaid\ngraph TD\n    A[Log Stream] --\u003e B[Stream Parser]\n    B --\u003e C[Error Detection]\n    B --\u003e D[Content Hashing]\n    C --\u003e E[Cache Check]\n    D --\u003e E\n    E --\u003e F{Cache Hit?}\n    F --\u003e|Yes| G[Return Cached Result]\n    F --\u003e|No| H[AI Provider Selection]\n    H --\u003e I[OpenAI]\n    H --\u003e J[Anthropic]\n    H --\u003e K[Google Gemini]\n    H --\u003e L[Local/Ollama]\n    I --\u003e M[AI Analysis]\n    J --\u003e M\n    K --\u003e M\n    L --\u003e M\n    M --\u003e N[Cache Result]\n    N --\u003e O[Rich Output]\n```\n\n---\n\n## 🛠️ Contributing\n\nWe love contributions! Here's how you can help make LogLense even better:\n\n### 🐛 Bug Reports \u0026 Feature Requests\n\nFound a bug or have an idea? [Open an issue](https://github.com/yourusername/loglense/issues) with:\n- Clear description of the problem/feature\n- Steps to reproduce (for bugs)\n- Your environment details\n- Sample log files (anonymized)\n\n### 🔧 Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/yourusername/loglense.git\ncd loglense\n\n# Create virtual environment\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n\n# Install in development mode\npip install -e .\n\n# Install development dependencies\npip install pytest black flake8 mypy\n\n# Run tests\npytest\n\n# Format code\nblack loglense_package/\n```\n\n### 🎯 Areas We Need Help With\n\n- [ ] **Testing Framework**: Add comprehensive test suite for reliability\n- [ ] **New AI Providers**: Add support for additional AI services\n- [ ] **Documentation**: More real-world examples and use cases\n- [ ] **Error Handling**: Improve network timeout and rate limit handling\n- [ ] **Configuration**: Enhanced config validation and migration\n\n### 📝 Pull Request Guidelines\n\n1. **Fork** the repository\n2. **Create** a feature branch (`git checkout -b feature/amazing-feature`)\n3. **Write** tests for your changes\n4. **Ensure** your code follows Python best practices\n6. **Commit** your changes (`git commit -m 'Add amazing feature'`)\n7. **Push** to the branch (`git push origin feature/amazing-feature`)\n8. **Open** a Pull Request\n\n---\n\n## 🔒 Security \u0026 Privacy\n\n- **API Keys**: Stored locally in `~/.config/loglense/config.json`\n- **Log Data**: Never stored permanently, only processed in memory\n- **Cache**: Contains only AI analysis results, not raw logs\n- **Local Models**: Full privacy with Ollama integration\n\n---\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 🙏 Acknowledgments\n\n- **[Typer](https://typer.tiangolo.com/)** - For the amazing CLI framework\n- **[Rich](https://rich.readthedocs.io/)** - For beautiful terminal output\n- **[LiteLLM](https://litellm.ai/)** - For unified AI provider interfaces\n\n---\n\n\u003cdiv align=\"center\"\u003e\n\n### 🌟 Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=greenblade29/loglense\u0026type=Date)](https://star-history.com/#greenblade29/loglense\u0026Date)\n\n**Purr-fect for debugging - because every log has nine lives** 🐱\n\n[⬆ Back to Top](#-loglense)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenblade29%2Floglense","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenblade29%2Floglense","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenblade29%2Floglense/lists"}