{"id":51026771,"url":"https://github.com/gitstq/logsentry","last_synced_at":"2026-06-21T20:02:19.883Z","repository":{"id":358829042,"uuid":"1243258643","full_name":"gitstq/logsentry","owner":"gitstq","description":"🛡️ Lightweight Log Intelligence Analysis Engine CLI - Zero dependencies, real-time monitoring, anomaly detection, multi-format reports | 轻量级日志智能分析引擎","archived":false,"fork":false,"pushed_at":"2026-05-19T07:25:06.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-19T09:58:28.738Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/gitstq.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-19T07:20:29.000Z","updated_at":"2026-05-19T07:24:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gitstq/logsentry","commit_stats":null,"previous_names":["gitstq/logsentry"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gitstq/logsentry","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Flogsentry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Flogsentry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Flogsentry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Flogsentry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gitstq","download_url":"https://codeload.github.com/gitstq/logsentry/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gitstq%2Flogsentry/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34623906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-21T02:00:05.568Z","response_time":54,"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":[],"created_at":"2026-06-21T20:02:19.050Z","updated_at":"2026-06-21T20:02:19.877Z","avatar_url":"https://github.com/gitstq.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🛡️ LogSentry\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Python-3.8+-blue.svg\" alt=\"Python 3.8+\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-MIT-green.svg\" alt=\"MIT License\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Zero_Dependencies-✓-brightgreen.svg\" alt=\"Zero Dependencies\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey.svg\" alt=\"Cross Platform\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eLightweight Log Intelligence Analysis Engine CLI\u003c/b\u003e\u003cbr\u003e\n  \u003cb\u003e轻量级日志智能分析引擎\u003c/b\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#english\"\u003eEnglish\u003c/a\u003e |\n  \u003ca href=\"#简体中文\"\u003e简体中文\u003c/a\u003e |\n  \u003ca href=\"#繁體中文\"\u003e繁體中文\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003ca name=\"english\"\u003e\u003c/a\u003e\n## 🎉 Introduction\n\n**LogSentry** is a lightweight, zero-dependency Python CLI tool designed for intelligent log analysis, anomaly detection, and multi-format reporting. Whether you're a system administrator, developer, or DevOps engineer, LogSentry helps you quickly understand what's happening in your log files.\n\n### 🌟 Why LogSentry?\n\n- **Zero Dependencies**: Uses only Python standard library - no pip install nightmares\n- **Multi-Format Support**: Handles plain text, gzip, bzip2, and xz compressed logs\n- **Smart Parsing**: Automatically detects timestamps and log levels from various formats\n- **Anomaly Detection**: Identifies error spikes, time gaps, and traffic bursts\n- **Real-Time Monitoring**: Watch logs as they grow with color-coded output\n- **Flexible Reports**: Export analysis results as Text, JSON, Markdown, or HTML\n\n---\n\n## ✨ Core Features\n\n| Feature | Description |\n|---------|-------------|\n| 📊 **Log Analysis** | Parse and analyze log files with automatic format detection |\n| 🔍 **Anomaly Detection** | Detect error spikes, unusual time gaps, and traffic bursts |\n| 📈 **Statistics** | Level distribution, hourly patterns, source tracking |\n| 🖥️ **Real-Time Monitor** | Watch log files in real-time with color-coded output |\n| 📄 **Multi-Format Reports** | Generate Text, JSON, Markdown, and HTML reports |\n| 🗜️ **Compression Support** | Read gzip, bzip2, and xz compressed logs directly |\n| 🎯 **Zero Dependencies** | Pure Python standard library - no external packages |\n\n---\n\n## 🚀 Quick Start\n\n### Requirements\n\n- Python 3.8 or higher\n- No external dependencies required!\n\n### Installation\n\n#### Option 1: Direct Download\n\n```bash\n# Download the script\ncurl -O https://raw.githubusercontent.com/gitstq/logsentry/main/logsentry.py\n\n# Make it executable\nchmod +x logsentry.py\n\n# Run it\npython3 logsentry.py --help\n```\n\n#### Option 2: Install via pip\n\n```bash\npip install git+https://github.com/gitstq/logsentry.git\n```\n\n#### Option 3: Clone and Install\n\n```bash\ngit clone https://github.com/gitstq/logsentry.git\ncd logsentry\npip install -e .\n```\n\n---\n\n## 📖 Usage Guide\n\n### Analyze Log Files\n\n```bash\n# Basic analysis\nlogsentry analyze /var/log/syslog\n\n# Analyze multiple files\nlogsentry analyze app.log nginx.log\n\n# Export as JSON\nlogsentry analyze app.log --format json --output report.json\n\n# Export as HTML report\nlogsentry analyze app.log --format html --output report.html\n\n# Export as Markdown\nlogsentry analyze app.log --format markdown --output report.md\n```\n\n### Real-Time Monitoring\n\n```bash\n# Monitor a log file in real-time\nlogsentry monitor /var/log/nginx/access.log\n\n# Monitor with level filter\nlogsentry monitor app.log --filter ERROR\n```\n\n### Parse Single Line\n\n```bash\n# Test parsing on a single line\nlogsentry parse \"2024-01-15 10:30:45 ERROR Connection timeout\"\n```\n\n---\n\n## 💡 Supported Log Formats\n\nLogSentry automatically detects and parses the following timestamp formats:\n\n- **ISO 8601**: `2024-01-15T10:30:45Z`\n- **Common**: `Jan 15 10:30:45`\n- **Common with Year**: `Jan 15 2024 10:30:45`\n- **Numeric**: `15/01/2024 10:30:45`\n- **Numeric US**: `01/15/2024 10:30:45`\n\nSupported log levels: DEBUG, INFO, WARNING, ERROR, CRITICAL, and their abbreviations.\n\n---\n\n## 📦 Report Examples\n\n### Text Report\n\n```\n============================================================\nLogSentry Analysis Report\n============================================================\n\nTotal lines analyzed: 5,234\nSuccessfully parsed: 5,230\nTime range: 2024-01-15 00:00:00 to 2024-01-15 23:59:59 (23:59:59)\n\nLog level distribution:\n  INFO: 4,500 (86.0%)\n  DEBUG: 500 (9.6%)\n  ERROR: 200 (3.8%)\n  WARNING: 30 (0.6%)\n\n⚠️  Detected 1 anomaly/anomalies:\n  🔴 [error_spike] High error rate: 200 errors (3.8%)\n\n----------------------------------------\nTop Error Messages\n----------------------------------------\n  (45x) Connection timeout after 30s...\n  (32x) Database connection failed...\n\n============================================================\n```\n\n---\n\n## 🔧 Development\n\n### Running Tests\n\n```bash\npython3 test_logsentry.py\n```\n\n### Project Structure\n\n```\nlogsentry/\n├── logsentry.py      # Main module\n├── test_logsentry.py # Unit tests\n├── setup.py          # Package setup\n├── requirements.txt  # Dependencies (empty - zero deps!)\n├── LICENSE           # MIT License\n└── README.md         # This file\n```\n\n---\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'feat: Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\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\u003ca name=\"简体中文\"\u003e\u003c/a\u003e\n## 🎉 项目介绍\n\n**LogSentry** 是一个轻量级、零依赖的 Python CLI 工具，专为智能日志分析、异常检测和多格式报告而设计。无论您是系统管理员、开发人员还是 DevOps 工程师，LogSentry 都能帮助您快速了解日志文件中发生的事情。\n\n### 🌟 为什么选择 LogSentry？\n\n- **零依赖**：仅使用 Python 标准库 - 无需 pip 安装烦恼\n- **多格式支持**：处理纯文本、gzip、bzip2 和 xz 压缩日志\n- **智能解析**：自动检测各种格式的时间戳和日志级别\n- **异常检测**：识别错误峰值、时间间隔异常和流量突发\n- **实时监控**：通过颜色编码输出实时查看日志\n- **灵活报告**：将分析结果导出为文本、JSON、Markdown 或 HTML\n\n---\n\n## ✨ 核心特性\n\n| 特性 | 描述 |\n|---------|-------------|\n| 📊 **日志分析** | 自动格式检测的日志解析和分析 |\n| 🔍 **异常检测** | 检测错误峰值、异常时间间隔和流量突发 |\n| 📈 **统计分析** | 级别分布、小时模式、来源跟踪 |\n| 🖥️ **实时监控** | 通过颜色编码输出实时监控日志文件 |\n| 📄 **多格式报告** | 生成文本、JSON、Markdown 和 HTML 报告 |\n| 🗜️ **压缩支持** | 直接读取 gzip、bzip2 和 xz 压缩日志 |\n| 🎯 **零依赖** | 纯 Python 标准库 - 无需外部包 |\n\n---\n\n## 🚀 快速开始\n\n### 环境要求\n\n- Python 3.8 或更高版本\n- 无需外部依赖！\n\n### 安装方法\n\n#### 方法 1：直接下载\n\n```bash\n# 下载脚本\ncurl -O https://raw.githubusercontent.com/gitstq/logsentry/main/logsentry.py\n\n# 添加执行权限\nchmod +x logsentry.py\n\n# 运行\npython3 logsentry.py --help\n```\n\n#### 方法 2：通过 pip 安装\n\n```bash\npip install git+https://github.com/gitstq/logsentry.git\n```\n\n#### 方法 3：克隆并安装\n\n```bash\ngit clone https://github.com/gitstq/logsentry.git\ncd logsentry\npip install -e .\n```\n\n---\n\n## 📖 使用指南\n\n### 分析日志文件\n\n```bash\n# 基础分析\nlogsentry analyze /var/log/syslog\n\n# 分析多个文件\nlogsentry analyze app.log nginx.log\n\n# 导出为 JSON\nlogsentry analyze app.log --format json --output report.json\n\n# 导出为 HTML 报告\nlogsentry analyze app.log --format html --output report.html\n\n# 导出为 Markdown\nlogsentry analyze app.log --format markdown --output report.md\n```\n\n### 实时监控\n\n```bash\n# 实时监控日志文件\nlogsentry monitor /var/log/nginx/access.log\n\n# 带级别过滤的监控\nlogsentry monitor app.log --filter ERROR\n```\n\n### 解析单行\n\n```bash\n# 测试单行解析\nlogsentry parse \"2024-01-15 10:30:45 ERROR Connection timeout\"\n```\n\n---\n\n## 💡 支持的日志格式\n\nLogSentry 自动检测和解析以下时间戳格式：\n\n- **ISO 8601**: `2024-01-15T10:30:45Z`\n- **常用格式**: `Jan 15 10:30:45`\n- **带年份格式**: `Jan 15 2024 10:30:45`\n- **数字格式**: `15/01/2024 10:30:45`\n- **美式数字格式**: `01/15/2024 10:30:45`\n\n支持的日志级别：DEBUG、INFO、WARNING、ERROR、CRITICAL 及其缩写。\n\n---\n\n## 📦 报告示例\n\n### 文本报告\n\n```\n============================================================\nLogSentry 分析报告\n============================================================\n\n总行数分析: 5,234\n成功解析: 5,230\n时间范围: 2024-01-15 00:00:00 到 2024-01-15 23:59:59 (23:59:59)\n\n日志级别分布:\n  INFO: 4,500 (86.0%)\n  DEBUG: 500 (9.6%)\n  ERROR: 200 (3.8%)\n  WARNING: 30 (0.6%)\n\n⚠️  检测到 1 个异常:\n  🔴 [error_spike] 错误率过高: 200 个错误 (3.8%)\n\n----------------------------------------\n热门错误消息\n----------------------------------------\n  (45x) 连接超时 30s...\n  (32x) 数据库连接失败...\n\n============================================================\n```\n\n---\n\n## 🔧 开发\n\n### 运行测试\n\n```bash\npython3 test_logsentry.py\n```\n\n### 项目结构\n\n```\nlogsentry/\n├── logsentry.py      # 主模块\n├── test_logsentry.py # 单元测试\n├── setup.py          # 包配置\n├── requirements.txt  # 依赖（空 - 零依赖！）\n├── LICENSE           # MIT 许可证\n└── README.md         # 本文件\n```\n\n---\n\n## 🤝 贡献指南\n\n欢迎贡献！请随时提交 Pull Request。\n\n1. Fork 本仓库\n2. 创建您的功能分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交您的更改 (`git commit -m 'feat: 添加某个 AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 打开 Pull Request\n\n---\n\n## 📄 开源协议\n\n本项目采用 MIT 许可证 - 详情请参阅 [LICENSE](LICENSE) 文件。\n\n---\n\n\u003ca name=\"繁體中文\"\u003e\u003c/a\u003e\n## 🎉 專案介紹\n\n**LogSentry** 是一個輕量級、零依賴的 Python CLI 工具，專為智慧日誌分析、異常檢測和多格式報告而設計。無論您是系統管理員、開發人員還是 DevOps 工程師，LogSentry 都能幫助您快速了解日誌檔案中發生的事情。\n\n### 🌟 為什麼選擇 LogSentry？\n\n- **零依賴**：僅使用 Python 標準函式庫 - 無需 pip 安裝煩惱\n- **多格式支援**：處理純文字、gzip、bzip2 和 xz 壓縮日誌\n- **智慧解析**：自動檢測各種格式的時間戳和日誌級別\n- **異常檢測**：識別錯誤峰值、時間間隔異常和流量突發\n- **即時監控**：透過顏色編碼輸出即時查看日誌\n- **靈活報告**：將分析結果匯出為文字、JSON、Markdown 或 HTML\n\n---\n\n## ✨ 核心特性\n\n| 特性 | 描述 |\n|---------|-------------|\n| 📊 **日誌分析** | 自動格式檢測的日誌解析和分析 |\n| 🔍 **異常檢測** | 檢測錯誤峰值、異常時間間隔和流量突發 |\n| 📈 **統計分析** | 級別分佈、小時模式、來源追蹤 |\n| 🖥️ **即時監控** | 透過顏色編碼輸出即時監控日誌檔案 |\n| 📄 **多格式報告** | 生成文字、JSON、Markdown 和 HTML 報告 |\n| 🗜️ **壓縮支援** | 直接讀取 gzip、bzip2 和 xz 壓縮日誌 |\n| 🎯 **零依賴** | 純 Python 標準函式庫 - 無需外部套件 |\n\n---\n\n## 🚀 快速開始\n\n### 環境需求\n\n- Python 3.8 或更高版本\n- 無需外部依賴！\n\n### 安裝方法\n\n#### 方法 1：直接下載\n\n```bash\n# 下載腳本\ncurl -O https://raw.githubusercontent.com/gitstq/logsentry/main/logsentry.py\n\n# 添加執行權限\nchmod +x logsentry.py\n\n# 執行\npython3 logsentry.py --help\n```\n\n#### 方法 2：透過 pip 安裝\n\n```bash\npip install git+https://github.com/gitstq/logsentry.git\n```\n\n#### 方法 3：克隆並安裝\n\n```bash\ngit clone https://github.com/gitstq/logsentry.git\ncd logsentry\npip install -e .\n```\n\n---\n\n## 📖 使用指南\n\n### 分析日誌檔案\n\n```bash\n# 基礎分析\nlogsentry analyze /var/log/syslog\n\n# 分析多個檔案\nlogsentry analyze app.log nginx.log\n\n# 匯出為 JSON\nlogsentry analyze app.log --format json --output report.json\n\n# 匯出為 HTML 報告\nlogsentry analyze app.log --format html --output report.html\n\n# 匯出為 Markdown\nlogsentry analyze app.log --format markdown --output report.md\n```\n\n### 即時監控\n\n```bash\n# 即時監控日誌檔案\nlogsentry monitor /var/log/nginx/access.log\n\n# 帶級別過濾的監控\nlogsentry monitor app.log --filter ERROR\n```\n\n### 解析單行\n\n```bash\n# 測試單行解析\nlogsentry parse \"2024-01-15 10:30:45 ERROR Connection timeout\"\n```\n\n---\n\n## 💡 支援的日誌格式\n\nLogSentry 自動檢測和解析以下時間戳格式：\n\n- **ISO 8601**: `2024-01-15T10:30:45Z`\n- **常用格式**: `Jan 15 10:30:45`\n- **帶年份格式**: `Jan 15 2024 10:30:45`\n- **數字格式**: `15/01/2024 10:30:45`\n- **美式數字格式**: `01/15/2024 10:30:45`\n\n支援的日誌級別：DEBUG、INFO、WARNING、ERROR、CRITICAL 及其縮寫。\n\n---\n\n## 📦 報告範例\n\n### 文字報告\n\n```\n============================================================\nLogSentry 分析報告\n============================================================\n\n總行數分析: 5,234\n成功解析: 5,230\n時間範圍: 2024-01-15 00:00:00 到 2024-01-15 23:59:59 (23:59:59)\n\n日誌級別分佈:\n  INFO: 4,500 (86.0%)\n  DEBUG: 500 (9.6%)\n  ERROR: 200 (3.8%)\n  WARNING: 30 (0.6%)\n\n⚠️  檢測到 1 個異常:\n  🔴 [error_spike] 錯誤率過高: 200 個錯誤 (3.8%)\n\n----------------------------------------\n熱門錯誤訊息\n----------------------------------------\n  (45x) 連線逾時 30s...\n  (32x) 資料庫連線失敗...\n\n============================================================\n```\n\n---\n\n## 🔧 開發\n\n### 執行測試\n\n```bash\npython3 test_logsentry.py\n```\n\n### 專案結構\n\n```\nlogsentry/\n├── logsentry.py      # 主模組\n├── test_logsentry.py # 單元測試\n├── setup.py          # 套件配置\n├── requirements.txt  # 依賴（空 - 零依賴！）\n├── LICENSE           # MIT 授權條款\n└── README.md         # 本檔案\n```\n\n---\n\n## 🤝 貢獻指南\n\n歡迎貢獻！請隨時提交 Pull Request。\n\n1. Fork 本倉庫\n2. 建立您的功能分支 (`git checkout -b feature/AmazingFeature`)\n3. 提交您的更改 (`git commit -m 'feat: 添加某個 AmazingFeature'`)\n4. 推送到分支 (`git push origin feature/AmazingFeature`)\n5. 開啟 Pull Request\n\n---\n\n## 📄 開源授權\n\n本專案採用 MIT 授權條款 - 詳情請參閱 [LICENSE](LICENSE) 檔案。\n\n---\n\n\u003cp align=\"center\"\u003e\n  Made with ❤️ by the LogSentry Team\u003cbr\u003e\n  \u003ca href=\"https://github.com/gitstq/logsentry\"\u003eGitHub\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Flogsentry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgitstq%2Flogsentry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgitstq%2Flogsentry/lists"}