diff --git a/troubleshooting/250921_happybell80_healthcheck_frequency_issue.md b/troubleshooting/250921_happybell80_healthcheck_frequency_issue.md new file mode 100644 index 0000000..4c111eb --- /dev/null +++ b/troubleshooting/250921_happybell80_healthcheck_frequency_issue.md @@ -0,0 +1,76 @@ +# 헬스체크 빈도 과다로 인한 로그 오염 문제 + +**작성일**: 2025-09-21 +**작성자**: happybell80 +**상태**: 문제 확인 + +## 문제 현상 + +rb8001 서비스가 매 30초마다 다른 서비스들의 헬스체크를 수행하면서 과도한 로그를 생성하고 있음. + +### 로그 패턴 +``` +{"time":"2025-09-21 23:24:33,703","level":"INFO","module":"httpx","msg":"HTTP Request: GET http://172.17.0.1:8501/health "HTTP/1.1 200 OK""} +{"time":"2025-09-21 23:24:33,705","level":"INFO","module":"httpx","msg":"HTTP Request: GET http://localhost:8505/health "HTTP/1.1 200 OK""} +{"time":"2025-09-21 23:24:33,707","level":"INFO","module":"httpx","msg":"HTTP Request: GET http://localhost:9024/health "HTTP/1.1 404 Not Found""} +``` + +## 문제점 + +1. **로그 과부하** + - 매 30초마다 3개 서비스 체크 = 분당 6개, 시간당 360개, 하루 8,640개 로그 + - 실제 에러나 중요한 이벤트 로그가 헬스체크 로그에 묻힘 + - 로그 분석 및 디버깅 어려움 + +2. **리소스 낭비** + - 불필요한 네트워크 요청 + - 로그 파일 용량 증가 + - 로그 로테이션 빈도 증가 + +3. **모니터링 실효성 부족** + - robeing-monitor (9024) 계속 404 반환 + - 30초 간격은 실시간 모니터링으로는 부족, 로깅으로는 과다 + +## 현재 설정 위치 (추정) + +- rb8001 서비스 내부 스케줄러 또는 백그라운드 태스크 +- APScheduler 또는 asyncio 기반 정기 실행 + +## 제안 해결책 + +### 1. 즉시 조치 +- 헬스체크 간격을 5분(300초)으로 증가 +- robeing-monitor 404 문제 해결 또는 체크 제외 + +### 2. 로그 레벨 조정 +```python +# httpx 로거 레벨을 WARNING으로 상향 +logging.getLogger("httpx").setLevel(logging.WARNING) + +# 또는 헬스체크 전용 로거 분리 +health_logger = logging.getLogger("healthcheck") +health_logger.setLevel(logging.WARNING) +``` + +### 3. 장기 개선 +- 헬스체크 결과를 메모리에 캐싱 +- 상태 변경 시에만 로그 기록 +- Prometheus 등 전문 모니터링 도구 도입 검토 + +## 영향 범위 + +- rb8001 로그 파일 +- Docker 컨테이너 로그 (json-file 드라이버) +- /mnt/51123logs 백업 로그 + +## 관련 문서 + +- 250908_rb8001_logging_issues.md - 로깅 시스템 구현 +- 250817_robeing_monitor_integration.md - robeing-monitor 통합 + +## 다음 단계 + +1. rb8001 코드에서 헬스체크 스케줄러 찾기 +2. 간격 설정을 환경변수로 외부화 +3. robeing-monitor health 엔드포인트 구현 또는 제거 +4. 로그 레벨 정책 수립 \ No newline at end of file