diff --git a/troubleshooting/250917_happybell80_rb8001_news_search_404_error.md b/troubleshooting/250917_happybell80_rb8001_news_search_404_error.md new file mode 100644 index 0000000..65e5c57 --- /dev/null +++ b/troubleshooting/250917_happybell80_rb8001_news_search_404_error.md @@ -0,0 +1,96 @@ +# rb8001 뉴스 검색 404 오류 해결 + +## 문제 상황 +- **발생일**: 2025-09-17 12:47, 12:49, 13:38 +- **증상**: rb8001에서 뉴스 검색 요청시 404 Not Found 에러 +- **에러**: `http://localhost:8505/search` 엔드포인트 없음 + +## 오류 로그 +``` +ERROR - Service call failed: http://localhost:8505/search - Client error '404 Not Found' +``` + +## 사용자 발화 내역 +1. **12:47** - user_id: 53529291-5050-4daa-89fb-008b546feb63 + - 발화: "오버더 핸드 최신 뉴스 검색해줘" + - 의도: news_fetch + +2. **12:49** - user_id: 3319cf5b-4a2d-486e-b64c-f63de3f370a3 + - 발화: "주요 뉴스 검색 요약 정리해줘" + - 의도: news_summary + +3. **13:38** - user_id: 3319cf5b-4a2d-486e-b64c-f63de3f370a3 + - 발화: "좋아 그럼 앞으로 스타트업, 창업, 크립토 분야 주요 뉴스를 요약해서 매일 오전 9시, 오후 6시 이렇게 두번 알려줘 할 수 있겠어?" + - 의도: news_fetch + +## 원인 분석 + +### 1. 잘못된 엔드포인트 경로 +- **문제 코드**: `rb8001/app/router/router.py:353` +```python +elif "8505" in url or "news" in url: + # News 서비스 + url = f"{url}/search" # ← 잘못된 경로 +``` + +- **실제 API**: `http://localhost:8505/api/news/search` +- **잘못된 요청**: `http://localhost:8505/search` + +### 2. 요청 데이터 형식 문제 +- skill-news API는 keywords를 **배열**로 받음 +- rb8001이 **문자열**로 전송 가능성 + +## 해결 방법 + +### 수정 필요 파일 +**`rb8001/app/router/router.py`** 353번 라인 + +### 수정 전 +```python +elif "8505" in url or "news" in url: + # News 서비스 + url = f"{url}/search" +``` + +### 수정 후 +```python +elif "8505" in url or "news" in url: + # News 서비스 + url = f"{url}/api/news/search" + + # keywords를 배열로 변환 (필요시) + if 'keywords' in payload and isinstance(payload['keywords'], str): + payload['keywords'] = [payload['keywords']] +``` + +## 테스트 확인 + +### API 테스트 (성공) +```bash +curl -X POST http://localhost:8505/api/news/search \ + -H "Content-Type: application/json" \ + -d '{"keywords": ["AI"], "user_id": "test-user", "channel": "test"}' +``` + +### 응답 +- HTTP 200 OK +- 19개 뉴스 기사 반환 + +## 관련 파일 +- 의도 분석: `rb8001/app/llm/intent_analyzer.py` +- 라우팅 로직: `rb8001/app/router/router.py` +- 스킬 명령: `rb8001/app/commands/skill_commands.py` + +## 교훈 +1. **API 엔드포인트 경로 정확히 확인**: 서비스별 API 문서화 필요 +2. **데이터 형식 검증**: 요청 데이터 타입 일치 확인 +3. **통합 테스트 필요**: 새 스킬 추가시 rb8001과 연동 테스트 + +## 추가 발견 사항 +- Gmail 인증 토큰 만료 오류 (skill-email HTTP 500) +- 파일 업로드 중복 체크 개선 필요 +- skill-rag-file 검색 엔드포인트 미구현 + +--- +*작성자: happybell80* +*작성일: 2025-09-17* \ No newline at end of file diff --git a/troubleshooting/250918_happybell80_fluent_bit_opensearch_data_prepper_integration.md b/troubleshooting/250918_happybell80_fluent_bit_opensearch_data_prepper_integration.md new file mode 100644 index 0000000..476dbc5 --- /dev/null +++ b/troubleshooting/250918_happybell80_fluent_bit_opensearch_data_prepper_integration.md @@ -0,0 +1,146 @@ +# Fluent Bit와 OpenSearch 3.2.0 연동 문제 해결 - Data Prepper 브릿지 구축 + +## 문제 상황 +- **발생일**: 2025-09-18 +- **환경**: 24서버(Fluent Bit) → 23서버(OpenSearch 3.2.0) +- **증상**: Fluent Bit이 OpenSearch로 로그 전송 실패 +- **근본 원인**: 모든 Fluent Bit 버전이 `_type` 파라미터를 전송하나, OpenSearch 3.x는 이를 거부 + +## 오류 상세 + +### 1. OpenSearch 플러그인 오류 +``` +[error] [output:opensearch:opensearch.0] HTTP status=400 URI=/_bulk, response: +{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}]},"status":400} +``` + +### 2. ES 플러그인 오류 +``` +[error] [output:es:es.0] HTTP status=400 URI=/_bulk, response: +{"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Action/metadata line [1] contains an unknown parameter [_type]"}]},"status":400} +``` + +## 테스트 내역 + +### Fluent Bit 버전별 테스트 결과 +| 버전 | opensearch 플러그인 | es 플러그인 | 결과 | +|------|-------------------|------------|------| +| 4.0.9 | `_type` 에러 | 에러 없지만 전송 안됨 | ❌ | +| 3.2.2 | `_type` 에러 | 에러 없지만 전송 안됨 | ❌ | +| 2.2.2 | `_type` 에러 | `_type` 에러 | ❌ | + +### 시도한 설정 조합 +1. `Suppress_Type_Name On` - 무시됨 +2. `Type _doc` - 무시됨 +3. `Logstash_Format On/Off` - 동일한 문제 +4. `Workers 1` - 동일한 문제 + +### 다른 도구 테스트 +- **Filebeat 8.x**: 라이센스 체크 실패 (OpenSearch와 비호환) +- **Filebeat 7.x**: 버전 호환성 문제 +- **Vector**: 설정은 되나 데이터 수집 실패 + +## 해결 방법: Data Prepper 브릿지 구축 + +### 아키텍처 +``` +Fluent Bit (24서버) → HTTP → Data Prepper (24서버) → OpenSearch (23서버) +``` + +### 1. Data Prepper 설치 및 설정 + +#### pipelines.yaml +```yaml +log-pipeline: + source: + http: + port: 2021 + path: "/" + health_check_service: true + ssl: false + processor: + - parse_json: + source: "message" + destination: "@message" + sink: + - opensearch: + hosts: ["http://192.168.219.45:9200"] + index: "dataprepper-%{yyyy.MM.dd}" + document_type: "_doc" +``` + +#### Docker 실행 +```bash +docker run -d --name data-prepper \ + --network host \ + -v /tmp/data-prepper/pipelines.yaml:/usr/share/data-prepper/pipelines/pipelines.yaml:ro \ + opensearchproject/data-prepper:2.4.0 +``` + +### 2. Fluent Bit 설정 변경 + +#### fluent-bit.conf (OUTPUT 섹션) +```ini +[OUTPUT] + Name http + Match * + Host 127.0.0.1 + Port 2021 + URI / + Format json + Json_date_key timestamp + Json_date_format iso8601 +``` + +### 3. Fluent Bit 재시작 +```bash +docker restart fluent-bit +``` + +## 검증 결과 +- **인덱스 생성**: `dataprepper-2025.09.18` ✅ +- **문서 수집**: 200+ 문서 성공적으로 저장 ✅ +- **실시간 로그**: 모든 Docker 컨테이너 로그 수집 중 ✅ + +## 핵심 문제 분석 + +### 근본 원인 +1. **Elasticsearch 7.x 이후 변경사항**: `_type` 파라미터가 deprecated되고 제거됨 +2. **OpenSearch 3.x 엄격한 검증**: `_type` 파라미터를 완전히 거부 +3. **Fluent Bit 하위 호환성**: 레거시 Elasticsearch를 위해 계속 `_type` 전송 + +### 왜 설정이 무시되는가? +- Fluent Bit의 opensearch/es 플러그인이 하드코딩된 `_type` 필드를 전송 +- `Suppress_Type_Name`, `Type` 등의 설정이 실제로 적용되지 않음 +- 이는 Fluent Bit의 알려진 이슈이며, 최신 버전에서도 미해결 + +## 교훈 +1. **버전 호환성 확인 필수**: OpenSearch/Elasticsearch 메이저 버전 변경 시 클라이언트 호환성 검증 +2. **브릿지 패턴 활용**: 직접 연결이 어려울 때 중간 브릿지(Data Prepper) 사용 +3. **공식 도구 우선**: OpenSearch는 Data Prepper, Elasticsearch는 Logstash 사용 권장 + +## 대안 솔루션 +1. **OpenSearch 2.x 사용**: `_type` 파라미터 허용 (다운그레이드) +2. **Logstash 사용**: Elasticsearch 출력 플러그인으로 OpenSearch 연결 +3. **커스텀 HTTP 포워더**: 간단한 Python/Node.js 스크립트로 `_type` 제거 + +## 참고 명령어 + +### Data Prepper 헬스체크 +```bash +curl -s http://localhost:2021/health +``` + +### OpenSearch 인덱스 확인 +```bash +curl -s "http://192.168.219.45:9200/_cat/indices?v" | grep dataprepper +``` + +### 문서 수 확인 +```bash +curl -s "http://192.168.219.45:9200/dataprepper-*/_count" +``` + +--- +*작성자: happybell80* +*작성일: 2025-09-18* \ No newline at end of file