OpenSearch
GenD 감사 로그 저장소인 OpenSearch의 배포 및 관리 방법입니다.
개요
OpenSearch 2.x는 금융 규제(ISMS-P) 요구 사항에 따라 감사 로그를 3년간 보존하기 위한 전용 인스턴스입니다. GenD AuditMiddleware가 생성한 JSON 감사 로그를 Fluent Bit을 통해 수집합니다.
배포 구성
| 항목 | 값 |
|---|---|
| 매니페스트 | infra/opensearch/deployment.yaml |
| 네임스페이스 | gend |
| 포트 | 9200 (NodePort 30560) |
| 전략 | Recreate (PVC 단일 마운트) |
| 보안 | runAsNonRoot: true, runAsUser: 1000 |
인덱스 구조
| 인덱스 패턴 | 내용 | 롤링 |
|---|---|---|
gend-audit-YYYY.MM.DD | API 감사 로그 | 일별 |
Fluent Bit에서 Logstash_Format On, Logstash_Prefix gend-audit으로 일별 인덱스를 자동 생성합니다.
GenD API 연동 설정
GEND_OPENSEARCH_URL=http://opensearch.gend.svc.cluster.local:9200
GEND_OPENSEARCH_AUDIT_INDEX_PREFIX=gend-audit
감사 로그 조회
# 최근 감사 로그 조회
curl "http://localhost:30560/gend-audit-*/_search?pretty" \
-H "Content-Type: application/json" \
-d '{"query":{"match_all":{}},"size":10,"sort":[{"@timestamp":"desc"}]}'
인덱스 관리
ISM (Index State Management) 정책
장기 보존을 위한 인덱스 수명 주기 정책을 설정합니다:
- Hot: 최근 7일 (빠른 검색)
- Warm: 7일~90일 (읽기 전용)
- Cold: 90일~3년 (압축 보관)
- Delete: 3년 이후 삭제
디스크 관리
# 인덱스 크기 확인
curl "http://localhost:30560/_cat/indices/gend-audit-*?v&s=index"
# 오래된 인덱스 수동 삭제
curl -X DELETE "http://localhost:30560/gend-audit-2023.01.01"
초기화 주의 사항
OpenSearch는 vm.max_map_count=262144 설정이 필요합니다. Kind 환경에서는 initContainer로 자동 설정됩니다.