From 66e01607597b5d98bdfbf922d27de55228281c93 Mon Sep 17 00:00:00 2001 From: kappa Date: Fri, 10 Apr 2026 14:21:16 +0900 Subject: [PATCH] =?UTF-8?q?obsidian:=20VictoriaLogs=20=EC=A4=91=EC=95=99?= =?UTF-8?q?=20=EB=A1=9C=EA=B7=B8=20=ED=97=88=EB=B8=8C=20=ED=86=B5=ED=95=A9?= =?UTF-8?q?=20=E2=80=94=20=EC=98=A4=EC=82=AC=EC=B9=B4=20Vector=20+=20Crowd?= =?UTF-8?q?Sec=20acquisition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 오사카 APISIX에 Vector(Docker) 추가, VictoriaLogs ES bulk API로 로그 전송 - CrowdSec에 victorialogs acquisition (tail 모드) 추가, 서울+오사카 통합 수신 - anomaly-detect 설명에 오사카 포함 반영 - 기존 http-logger 직접 push는 레거시로 병행 유지 (추후 제거) Co-Authored-By: Claude Opus 4.6 (1M context) --- infra/anomaly-detect.md | 2 +- infra/crowdsec-safeline.md | 26 ++++++++++++++++++-------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/infra/anomaly-detect.md b/infra/anomaly-detect.md index e9a8694..10f4f4e 100644 --- a/infra/anomaly-detect.md +++ b/infra/anomaly-detect.md @@ -90,7 +90,7 @@ ssh incus-hp2 "incus exec anomaly-detect -- journalctl -u anomaly-detect.service **월 비용 예상**: 평시 사이클당 ~$0.001-0.002, 5분 주기 × 288/일 × 30일 = **~$10-15/월**. DDoS 발생 시 사이클당 $0.01 수준 (massive_ddos 시나리오 기준)까지 튈 수 있으나 일시적. -[[crowdsec-safeline#~~ddos-detect (AI 행위 분석)~~ — 폐기 (2026-04-08)|폐기된 ddos-detect]] 후속. [[victorialogs|VictoriaLogs]]에 적재된 K3s 서울 APISIX access log를 5분마다 분석하여 봇/공격성 IP를 [[crowdsec-safeline|CrowdSec]]에 자동 ban으로 등록한다. +[[crowdsec-safeline#~~ddos-detect (AI 행위 분석)~~ — 폐기 (2026-04-08)|폐기된 ddos-detect]] 후속. [[victorialogs|VictoriaLogs]]에 적재된 서울+오사카 APISIX access log를 5분마다 분석하여 봇/공격성 IP를 [[crowdsec-safeline|CrowdSec]]에 자동 ban으로 등록한다. ## 위치 / 사양 diff --git a/infra/crowdsec-safeline.md b/infra/crowdsec-safeline.md index 7b747a4..1ba0a1c 100644 --- a/infra/crowdsec-safeline.md +++ b/infra/crowdsec-safeline.md @@ -32,23 +32,33 @@ Traefik DaemonSet (stdout JSON accessLog) | 인증 | `Authorization: traefik-crowdsec-log-2024` | | 파서 | `crowdsecurity/traefik-logs` (Hub, JSON 모드) | -### APISIX → CrowdSec (http-logger) +### APISIX → VictoriaLogs → CrowdSec (서울+오사카 통합) ``` -APISIX K3s 서울 (apisix ns, global_rules http-logger 플러그인) - → 배치 50건, 5초 buffer - → CrowdSec HTTP acquisition (:8085/apisix-logs) +서울 APISIX (K3s) stdout → Vector DaemonSet → VictoriaLogs (ES bulk API) +오사카 APISIX (Docker) stdout → Vector (Docker) → VictoriaLogs (ES bulk API) + → CrowdSec victorialogs acquisition (tail 모드, 실시간) → custom/apisix-json-logs 파서 + + anomaly-detect (5분 폴링, AI 분석) ``` | 항목 | 값 | |------|-----| -| 송신처 | **K3s 서울 APISIX 단독** (osaka는 송신 안 함, zlambda는 라우트 비어있음) | -| 설정 | K3s APISIX Admin API `global_rules/http-logger` (`uri: http://10.253.100.240:8085/apisix-logs`) | +| VictoriaLogs | `vl.inouter.com` (K3s logging ns, Traefik IngressRoute) | +| CrowdSec acquisition | `/etc/crowdsec/acquis.d/victorialogs-apisix.yaml` (`source: victorialogs`, `mode: tail`, `query: program:apisix log_type:access`) | +| 서울 Vector | K3s DaemonSet (Helm `vector/vector`), `parse_apisix` transform → `vlogs` ES sink | +| 오사카 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` | -| 파서 | `custom/apisix-json-logs` (로컬) | -| osaka의 처리 | 송신은 안 하고 `crowdsec-bouncer` 글로벌 플러그인으로 결정 **소비**만. `real-ip` 플러그인도 글로벌. | ### APISIX → log-collector → CrowdSec (sandbox-tokyo)