Loading...
Loading...
Analyze application logs to identify errors, performance issues, and security anomalies. Use when debugging issues, monitoring system health, or investigating incidents. Handles various log formats including Apache, Nginx, application logs, and JSON logs.
npx skill4agent add supercent-io/skills-template log-analysis# 일반적인 로그 위치
/var/log/ # 시스템 로그
/var/log/nginx/ # Nginx 로그
/var/log/apache2/ # Apache 로그
./logs/ # 애플리케이션 로그# ERROR 레벨 로그 검색
grep -i "error\|exception\|fail" application.log
# 최근 에러 (마지막 100줄)
tail -100 application.log | grep -i error
# 타임스탬프 포함 에러
grep -E "^\[.*ERROR" application.log# 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# 시간대별 에러 카운트
grep -i error application.log | cut -d' ' -f1,2 | sort | uniq -c | sort -rn
# 특정 시간대 로그
grep "2025-01-05 14:" application.log# IP별 요청 수
awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -20
# 특정 IP 활동
grep "192.168.1.100" access.log# 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# 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# 로그 분석 리포트
## 요약
- 분석 기간: 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]-A-B