← 返回
未分类 中文

Log Parser

Parse and analyze various log formats (nginx, apache, syslog, application logs). Extract key information and generate reports.
解析和分析各种日志格式(nginx、apache、syslog、应用日志)。提取关键信息并生成报告。
freeter226
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 481
下载
💾 1
安装
1
版本
#latest

概述

Log Parser

A log parsing and analysis tool for security operations and DevOps.

Features

  • Multi-format Support - nginx, apache, syslog, application logs
  • Auto-detection - Automatically detect log format
  • Key Extraction - Extract IPs, timestamps, error codes, URLs
  • Filtering - Filter logs by IP, status code, time range
  • Statistics - Generate summary reports
  • Error Detection - Identify and highlight error entries

Usage

python3 skills/log-parser/scripts/log_parser.py <action> [options]

Actions

ActionDescription
---------------------
parseParse log file and extract fields
statsGenerate statistics report
filterFilter logs by criteria
errorsExtract error entries only
topTop N items (IPs, URLs, etc.)

Options

OptionTypeDefaultDescription
------------------------------------
--filestring-Log file path
--formatstringautoLog format (auto, nginx, apache, syslog)
--limitint100Max results to return
--filter-ipstring-Filter by IP address
--filter-statusstring-Filter by status code
--top-fieldstring-Field for top N (ip, url, status)

Supported Log Formats

nginx

192.168.1.1 - - [22/Mar/2026:14:00:00 +0800] "GET /api/test HTTP/1.1" 200 1234

apache

192.168.1.1 - - [22/Mar/2026:14:00:00 +0800] "GET /api/test HTTP/1.1" 200 1234

syslog

Mar 22 14:00:00 server sshd[12345]: Failed password for root from 192.168.1.1

application logs (JSON)

{"timestamp": "2026-03-22T14:00:00Z", "level": "ERROR", "message": "..."}

Examples

# Parse log file
python3 skills/log-parser/scripts/log_parser.py parse --file /var/log/nginx/access.log

# Generate statistics
python3 skills/log-parser/scripts/log_parser.py stats --file /var/log/nginx/access.log

# Filter by IP
python3 skills/log-parser/scripts/log_parser.py filter --file /var/log/nginx/access.log --filter-ip 192.168.1.1

# Get top 10 IPs
python3 skills/log-parser/scripts/log_parser.py top --file /var/log/nginx/access.log --top-field ip --limit 10

# Extract errors
python3 skills/log-parser/scripts/log_parser.py errors --file /var/log/nginx/access.log

Use Cases

  1. Security Analysis - Identify suspicious IPs, failed logins
  2. Performance Monitoring - Find slow requests, errors
  3. Traffic Analysis - Top URLs, user agents
  4. Debugging - Extract error entries quickly

Output Format

All results are returned in JSON format:

{
  "success": true,
  "total": 1000,
  "parsed": 998,
  "entries": [...],
  "stats": {...}
}

Current Status

In development.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-31 02:50 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

URL Toolkit

freeter226
URL编码解码、参数解析及URL操作开发者工具包
★ 0 📥 475

Timestamp Toolkit

freeter226
时间戳转换工具:在 Unix 时间戳、日期时间和各种日期格式之间进行转换。
★ 0 📥 408

JSON Wizard

freeter226
JSON格式化、验证及转换工具。支持格式化、压缩、校验JSON,以及JSON与YAML互转。
★ 0 📥 424