Log Analyzer Tool Description Parse and analyze log files to extract patterns, filter entries, generate statistics, and detect errors. Trigger - command - User needs to analyze logs - User wants to find errors in logs Usage Tags , , , , Compatibility - Codex: ✅ - Claude Code: ✅ ---

\n match = re.match(pattern, line)\n if match:\n return {'timestamp': match.group(1), 'level': match.group(2).upper(), 'message': match.group(3)}\n # Simple pattern: [LEVEL] message\n pattern2 = r'^\\[?(\\w+)\\]?\\s*[:-]?\\s*(.*)

Log Analyzer Tool Description Parse and analyze log files to extract patterns, filter entries, generate statistics, and detect errors. Trigger - command - User needs to analyze logs - User wants to find errors in logs Usage Tags , , , , Compatibility - Codex: ✅ - Claude Code: ✅ ---

\n match2 = re.match(pattern2, line)\n if match2 and match2.group(1).upper() in LOG_LEVELS:\n return {'timestamp': '', 'level': match2.group(1).upper(), 'message': match2.group(2)}\n return {'timestamp': '', 'level': 'INFO', 'message': line}\n\ndef analyze_logs(filepath, level=None, grep=None, stats=False, tail=None):\n \"\"\"Analyze log file.\"\"\"\n path = Path(filepath)\n if not path.exists():\n print(f\"Error: File not found: {filepath}\", file=sys.stderr)\n sys.exit(1)\n \n with open(path, 'r', encoding='utf-8', errors='ignore') as f:\n lines = f.readlines()\n \n if tail:\n lines = lines[-tail:]\n \n entries = [parse_log_line(line.strip()) for line in lines if line.strip()]\n \n # Filter by level\n if level:\n level_upper = level.upper()\n entries = [e for e in entries if e['level'] == level_upper]\n \n # Filter by grep pattern\n if grep:\n entries = [e for e in entries if grep.lower() in e['message'].lower()]\n \n if stats:\n level_counts = Counter(e['level'] for e in entries)\n print(f\"Total entries: {len(entries)}\")\n print(\"\\nBy level:\")\n for lvl in LOG_LEVELS:\n if lvl in level_counts:\n print(f\" {lvl}: {level_counts[lvl]}\")\n return\n \n for entry in entries:\n lvl = entry['level']\n color = '\\033[91m' if lvl in ['ERROR', 'FATAL', 'CRITICAL'] else ''\n reset = '\\033[0m' if color else ''\n ts = f\"[{entry['timestamp']}] \" if entry['timestamp'] else ''\n print(f\"{color}{ts}[{lvl}] {entry['message']}{reset}\")\n\ndef main():\n parser = argparse.ArgumentParser(description=\"Analyze log files\")\n parser.add_argument('file', help='Log file to analyze')\n parser.add_argument('--level', '-l', help='Filter by log level')\n parser.add_argument('--grep', '-g', help='Search pattern')\n parser.add_argument('--stats', '-s', action='store_true', help='Show statistics')\n parser.add_argument('--tail', '-t', type=int, help='Show last N lines')\n args = parser.parse_args()\n analyze_logs(args.file, args.level, args.grep, args.stats, args.tail)\n\nif __name__ == \"__main__\":\n main()\n","content_type":"text/x-python; charset=utf-8","language":"python","size":3086,"content_sha256":"5c46076a3c2f782659a0abfee79e5f367f372c59a4ea496a451766116ad80adb"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"Log Analyzer Tool","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Description","type":"text"}]},{"type":"paragraph","content":[{"text":"Parse and analyze log files to extract patterns, filter entries, generate statistics, and detect errors.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Trigger","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"/logs","type":"text","marks":[{"type":"code_inline"}]},{"text":" command","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User needs to analyze logs","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"User wants to find errors in logs","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Usage","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"# Analyze log file\npython scripts/log_analyzer.py app.log\n\n# Filter by level\npython scripts/log_analyzer.py app.log --level ERROR\n\n# Search pattern\npython scripts/log_analyzer.py app.log --grep \"connection failed\"\n\n# Get statistics\npython scripts/log_analyzer.py app.log --stats\n\n# Tail mode\npython scripts/log_analyzer.py app.log --tail 100","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Tags","type":"text"}]},{"type":"paragraph","content":[{"text":"logs","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"analysis","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"debugging","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"monitoring","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"errors","type":"text","marks":[{"type":"code_inline"}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Compatibility","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Codex: ✅","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Claude Code: ✅","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"log-analyzer","author":"@skillopedia","source":{"stars":80,"repo_name":"moyucode","origin_url":"https://github.com/aidotnet/moyucode/blob/HEAD/skills/tools/log-analyzer/SKILL.md","repo_owner":"aidotnet","body_sha256":"98b6f75b108b6cbbe1f1aed4baab73c9a1c78c3f11cfeddbdeb220827ca92878","cluster_key":"fefef2334c39508c16a52dff5ae2eb2b0888a58f6caacfd92647e1aab6df415a","clean_bundle":{"format":"clean-skill-bundle-v1","source":"aidotnet/moyucode/skills/tools/log-analyzer/SKILL.md","attachments":[{"id":"7c412380-a5f8-5c8a-b0c4-5c42bc9b92a4","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/7c412380-a5f8-5c8a-b0c4-5c42bc9b92a4/attachment.py","path":"scripts/log_analyzer.py","size":3086,"sha256":"5c46076a3c2f782659a0abfee79e5f367f372c59a4ea496a451766116ad80adb","contentType":"text/x-python; charset=utf-8"}],"bundle_sha256":"a8d14396cace6928bab56355a07bd1ee42a450b23da79d1598983130f9c5aa2b","attachment_count":1,"text_attachments":1,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":1,"skill_md_path":"skills/tools/log-analyzer/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"software-engineering","category_label":"Engineering"},"exact_dupes_collapsed_into_this":0},"version":"v1","category":"software-engineering","metadata":{"short-description":"分析日志文件"},"import_tag":"clean-skills-v1","description":"解析和分析日志文件,支持模式匹配、过滤、统计和错误检测。"}},"renderedAt":1782988363971}

Log Analyzer Tool Description Parse and analyze log files to extract patterns, filter entries, generate statistics, and detect errors. Trigger - command - User needs to analyze logs - User wants to find errors in logs Usage Tags , , , , Compatibility - Codex: ✅ - Claude Code: ✅ ---