diff --git a/history/2026-04-15-apisix-http-logger-removal.md b/history/2026-04-15-apisix-http-logger-removal.md new file mode 100644 index 0000000..15b6dd2 --- /dev/null +++ b/history/2026-04-15-apisix-http-logger-removal.md @@ -0,0 +1,103 @@ +--- +date: 2026-04-15 +topic: APISIX → CrowdSec http-logger 레거시 경로 제거 +areas: + - infra/crowdsec-safeline.md + - infra/apisix.md +--- + +# APISIX http-logger 레거시 경로 제거 (2026-04-15) + +## 배경 + +서울 K3s APISIX가 CrowdSec HTTP acquisition(:8085/apisix-logs)으로 직접 push하던 레거시 경로. VictoriaLogs 파이프라인 도입(2026-04-08) 이후 병행 중이었고, 이번 정리로 레거시 완전 종료. + +## 실측 결과: 이미 전 구간 제거 완료 + +작업 착수 후 현황 점검 결과, **모든 구간에서 http-logger 레거시는 이미 사실상 사라진 상태**였음. 본 작업은 실제 제거 변경 없이 doc 정리로 마무리. + +### 1. 서울 K3s APISIX + +Admin API 전수 스캔 (`global_rules`, `routes`, `services`, `plugin_configs`): + +```bash +$ curl -sS -H "X-API-KEY: ..." http://apisix-admin:9180/apisix/admin/global_rules +{"list":[{"key":"/apisix/global_rules/limit-req","value":{...,"plugins":{"limit-req":{...}}}}],"total":1} +``` + +`http-logger` 플러그인 흔적 없음. 언제 제거됐는지는 불명 — etcd 감사로그 미확보. + +### 2. K3s Vector 싱크 + +`~/k8s/vector/values.yaml` / `kubectl -n logging get cm vector -o yaml`: + +```yaml +sinks: + vlogs: # VictoriaLogs ES bulk (유일) + type: elasticsearch + inputs: [parse_apisix, parse_apisix_http, parse_traefik] + endpoints: [http://vlogs-victoria-logs-single-server.logging.svc.cluster.local:9428/insert/elasticsearch/] +``` + +과거 문서 기록(`crowdsecurity/traefik-logs` → :8086)의 HTTP 싱크는 이미 없음. **모든 로그가 VictoriaLogs로만 흐름.** + +### 3. 오사카 APISIX + +`/apisix/osaka/global_rules/1`에 `http-logger`가 존재하지만 target URI가 `https://vector.inouter.com/` — **신규 VictoriaLogs 파이프라인**이지 레거시 CrowdSec(:8085) 아님. 보존. + +```json +"http-logger": { + "uri": "https://vector.inouter.com/", + "concat_method": "new_line", + "batch_max_size": 50, + ... +} +``` + +### 4. CrowdSec LAPI (jp1 crowdsec 컨테이너) + +``` +$ ls /etc/crowdsec/acquis.d/ +safeline-http.yaml # :8088 (SafeLine) +victorialogs-apisix.yaml # VictoriaLogs tail 모드 +victorialogs-traefik.yaml # VictoriaLogs tail 모드 + +$ ss -tlnp | grep crowdsec +LISTEN *:6060 (metrics) +LISTEN *:8080 (LAPI) +LISTEN *:8088 (safeline acquisition) +# log-collector(:8087) 별도 데몬 +``` + +**:8085 listener 없음, apisix-logs HTTP acquisition 파일 없음.** 언제 제거됐는지는 불명. + +### 5. CrowdSec 메트릭 (runtime verification) + +`curl http://10.253.100.240:6060/metrics | grep cs_parser_hits`: + +``` +cs_parser_hits_ok_total{acquis_type="nginx",source="https://vl.inouter.com/",type="victorialogs"} 26 +cs_parser_hits_ok_total{acquis_type="traefik",source="https://vl.inouter.com/",type="victorialogs"} 115441 +cs_parser_hits_ko_total{acquis_type="nginx",source="https://vl.inouter.com/",type="victorialogs"} 146 +``` + +**유일한 acquisition source는 `https://vl.inouter.com/` (victorialogs type).** 8085/8086 HTTP acquisition 히트 0. + +버킷 pour: +``` +cs_bucket_poured_total{name="custom/apisix-high-rate-per-ip",source="https://vl.inouter.com/",type="victorialogs"} 115463 +cs_bucket_poured_total{name="custom/apisix-499-burst",source="https://vl.inouter.com/",type="victorialogs"} 1 +``` + +APISIX 시나리오는 전부 VictoriaLogs 소스에서 발동 — 피드백 루프 정상. + +## 조치 사항 + +- `infra/crowdsec-safeline.md` "APISIX → CrowdSec (http-logger, 레거시)" 섹션 삭제 +- 본 history 파일로 이력 분리 +- graphify 업데이트 + +## 남는 이슈 / 메모 + +- **parser name 불일치**: 정본 doc에 `custom/apisix-json-logs` 파서 기재돼 있으나 `victorialogs-apisix.yaml`의 `labels.type: nginx`. 실제 파싱은 nginx 계열 파서가 처리(APISIX access log가 nginx format이므로 동작). 추후 doc 정정 대상. +- **관련 정본 경량화**: 3차 보안 구조 섹션의 "APISIX 로그: http-logger → :8085 → custom/apisix-json-logs" 문구도 현행(VictoriaLogs)로 갱신 필요. diff --git a/infra/crowdsec-safeline.md b/infra/crowdsec-safeline.md index 1ba0a1c..90049c3 100644 --- a/infra/crowdsec-safeline.md +++ b/infra/crowdsec-safeline.md @@ -50,16 +50,6 @@ Traefik DaemonSet (stdout JSON accessLog) | 오사카 Vector | Docker `timberio/vector:0.45.0-debian`, `/etc/vector/vector.yaml`, `docker_logs` source → `parse_apisix` → `vlogs` ES sink. `location: osaka` 필드 추가 | | 파서 | `custom/apisix-json-logs` (로컬) | -### APISIX → CrowdSec (http-logger, 레거시 — 병행 중) - -서울 APISIX가 CrowdSec HTTP acquisition으로 직접 push하는 기존 경로. VictoriaLogs 경로와 이중 수신 중이며 추후 제거 예정. - -| 항목 | 값 | -|------|-----| -| 설정 | K3s APISIX GatewayProxy `global_rules/http-logger` (`uri: http://10.253.100.240:8085/apisix-logs`) | -| CrowdSec 포트 | 8085 | -| 인증 | `Authorization: apisix-crowdsec-log-2024` | - ### APISIX → log-collector → CrowdSec (sandbox-tokyo) ``` @@ -172,7 +162,7 @@ ddos-detect AI 분석기 폐기 후 deterministic 패턴 매칭으로 대체. - 현재 모두 `remediation: true` (즉시 ban). dry-run으로 시작 안 함 — false positive 발생 시 임계값 또는 ban duration 조정. -과거 인시던트 및 변경 이력은 `history/` 참조. 예: `history/2026-04-10-edge-cleanup.md` (cf-audit-cleanup-2 3-incident chain, Turnstile sitekey 교체, 미들웨어 64811 `/__captcha/verify` 버그 수정 등). +과거 인시던트 및 변경 이력은 `history/` 참조. 예: `history/2026-04-10-edge-cleanup.md` (cf-audit-cleanup-2 3-incident chain, Turnstile sitekey 교체, 미들웨어 64811 `/__captcha/verify` 버그 수정 등), [[../history/2026-04-15-apisix-http-logger-removal|2026-04-15 APISIX http-logger 레거시 제거]]. ### 발견 사항: K3s APISIX 글로벌 limit-req @@ -285,8 +275,9 @@ Kappa 계정용 `cs-cf-worker-bouncer`와 별도 컨테이너로 분리 운영. - tengine 미사용, APISIX 직접 연동 ### 3차: CrowdSec 로그 분석 -- Traefik 로그: Vector DaemonSet → `:8086` → `crowdsecurity/traefik-logs` -- APISIX 로그: http-logger → `:8085` → `custom/apisix-json-logs` +- Traefik / APISIX 로그: Vector → VictoriaLogs(`vl.inouter.com`) → CrowdSec `victorialogs` acquisition (tail 모드) +- SafeLine 차단: PG NOTIFY → safeline-listener → CrowdSec HTTP acquisition(`:8088`) +- sandbox-tokyo APISIX: http-logger → log-collector(`:8087`) → CrowdSec - HTTP 시나리오 매칭 → decision → bouncer 피드백 ## iron-kr-waf BunnyCDN Pull Zone (구 waf-kr)