log-analysis
34
总安装量
35
周安装量
#6078
全站排名
安装命令
npx skills add https://github.com/supercent-io/skills-template --skill log-analysis
Agent 安装分布
opencode
30
gemini-cli
26
claude-code
26
github-copilot
21
antigravity
18
Skill 文档
Log Analysis
When to use this skill
- ì¤ë¥ ëë²ê¹ : ì í리ì¼ì´ì ì¤ë¥ ìì¸ ë¶ì
- ì±ë¥ ë¶ì: ìëµ ìê°, ì²ë¦¬ë ë¶ì
- ë³´ì ê°ì¬: ë¹ì ì ì ê·¼ í¨í´ íì§
- ì¸ìëí¸ ëì: ì¥ì ë°ì ì ìì¸ ì¡°ì¬
Instructions
Step 1: ë¡ê·¸ íì¼ ìì¹ íì
# ì¼ë°ì ì¸ ë¡ê·¸ ìì¹
/var/log/ # ìì¤í
ë¡ê·¸
/var/log/nginx/ # Nginx ë¡ê·¸
/var/log/apache2/ # Apache ë¡ê·¸
./logs/ # ì í리ì¼ì´ì
ë¡ê·¸
Step 2: ìë¬ í¨í´ ê²ì
ì¼ë° ìë¬ ê²ì:
# ERROR ë 벨 ë¡ê·¸ ê²ì
grep -i "error\|exception\|fail" application.log
# ìµê·¼ ìë¬ (ë§ì§ë§ 100ì¤)
tail -100 application.log | grep -i error
# íìì¤í¬í í¬í¨ ìë¬
grep -E "^\[.*ERROR" application.log
HTTP ìë¬ ì½ë:
# 5xx ìë² ìë¬
grep -E "HTTP/[0-9.]+ 5[0-9]{2}" access.log
# 4xx í´ë¼ì´ì¸í¸ ìë¬
grep -E "HTTP/[0-9.]+ 4[0-9]{2}" access.log
# í¹ì ìë¬ ì½ë
grep "HTTP/1.1\" 500" access.log
Step 3: í¨í´ ë¶ì
ìê°ë³ ë¶ì:
# ìê°ëë³ ìë¬ ì¹´ì´í¸
grep -i error application.log | cut -d' ' -f1,2 | sort | uniq -c | sort -rn
# í¹ì ìê°ë ë¡ê·¸
grep "2025-01-05 14:" application.log
IPë³ ë¶ì:
# IPë³ ìì² ì
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20
# í¹ì IP íë
grep "192.168.1.100" access.log
Step 4: ì±ë¥ ë¶ì
ìëµ ìê° ë¶ì:
# Nginx ë¡ê·¸ìì ìëµ ìê° ì¶ì¶
awk '{print $NF}' access.log | sort -n | tail -20
# ë린 ìì² (1ì´ ì´ì)
awk '$NF > 1.0 {print $0}' access.log
ìì²ë ë¶ì:
# ë¶ë¹ ìì² ì
awk '{print $4}' access.log | cut -d: -f1,2,3 | uniq -c
# ìëí¬ì¸í¸ë³ ìì² ì
awk '{print $7}' access.log | sort | uniq -c | sort -rn | head -20
Step 5: ë³´ì ë¶ì
ìì¬ì¤ë¬ì´ í¨í´:
# SQL Injection ìë
grep -iE "(union|select|insert|update|delete|drop).*--" access.log
# XSS ìë
grep -iE "<script|javascript:|onerror=" access.log
# ëë í 리 í¸ëë²ì¤
grep -E "\.\./" access.log
# ë¬´ì°¨ë³ ëì
공격
grep -E "POST.*/login" access.log | awk '{print $1}' | sort | uniq -c | sort -rn
Output format
ë¶ì 리í¬í¸ 구조
# ë¡ê·¸ ë¶ì 리í¬í¸
## ìì½
- ë¶ì 기ê°: YYYY-MM-DD HH:MM ~ YYYY-MM-DD HH:MM
- ì´ ë¡ê·¸ ë¼ì¸: X,XXX
- ìë¬ ì: XXX
- ê²½ê³ ì: XXX
## ìë¬ ë¶ì
| ìë¬ ì í | ë°ì íì | ìµê·¼ ë°ì |
|----------|-----------|----------|
| Error A | 150 | 2025-01-05 14:30 |
| Error B | 45 | 2025-01-05 14:25 |
## ê¶ì¥ ì¡°ì¹
1. [ì¡°ì¹ 1]
2. [ì¡°ì¹ 2]
Best practices
- ìê° ë²ì ì§ì : ë¶ìí ìê° ë²ì를 ëª íí ì¤ì
- í¨í´ ì ì¥: ì주 ì¬ì©íë grep í¨í´ ì¤í¬ë¦½í¸í
- 컨í
ì¤í¸ íì¸: ìë¬ ì í ë¡ê·¸ë í¨ê» íì¸ (
-A,-Bìµì ) - ë¡ê·¸ ë¡í ì´ì : ìì¶ë ë¡ê·¸ë zgrepì¼ë¡ ê²ì
Constraints
íì ê·ì¹ (MUST)
- ì½ê¸° ì ì© ìì ë§ ìí
- 민ê°í ì ë³´(ë¹ë°ë²í¸, í í°) ë§ì¤í¹
ê¸ì§ ì¬í (MUST NOT)
- ë¡ê·¸ íì¼ ìì ê¸ì§
- ë¯¼ê° ì ë³´ ì¸ë¶ ë ¸ì¶ ê¸ì§