-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73f89d7
commit 371ef60
Showing
1 changed file
with
96 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
_posts/development/istio/2024-03-16-istio-envoy-logging.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
--- | ||
title: "Istio Envoy Logging" | ||
toc: true | ||
toc_sticky: true | ||
categories: ["Kubernetes", "Istio"] | ||
excerpt: "" | ||
last_modified_at: 2024-03-18 | ||
--- | ||
|
||
|
||
# ์ฌ์ ์ค๋น | ||
|
||
```bash | ||
k apply -f https://raw.githubusercontent.com/istio/istio/master/samples/helloworld/helloworld.yaml | ||
``` | ||
|
||
# Enable Access Logging | ||
|
||
## Telemetry API | ||
|
||
```yaml | ||
apiVersion: telemetry.istio.io/v1alpha1 | ||
kind: Telemetry | ||
metadata: | ||
name: default-ns-logging | ||
namespace: default | ||
spec: | ||
accessLogging: | ||
- providers: | ||
- name: envoy | ||
``` | ||
```bash | ||
$ k exec -it ... -- sh | ||
~ $ curl http://helloworld.default.svc.cluster.local:5000/hello | ||
--- | ||
$ k exec -it helloworld... -c istio-proxy -- sh | ||
... | ||
[2024-03-18T23:08:48.020Z] "GET /hello HTTP/1.1" 200 - via_upstream - "-" 0 59 52 51 "-" "curl/8.6.0" "a0698764-a04d-48c8-8914-045808d19898" "helloworld.default.svc.cluster.local:5000" "10.42.0.4:5000" inbound|5000|| 127.0.0.6:60873 10.42.0.4:5000 10.42.0.6:48352 outbound_.5000_._.helloworld.default.svc.cluster.local default | ||
... | ||
[2024-03-18T23:10:51.528Z] "GET /hello HTTP/1.1" 200 - via_upstream - "-" 0 59 38 37 "-" "curl/7.88.1" "5c3abfa9-c806-490b-a5ec-a6659f866490" "helloworld.default.svc.cluster.local:5000" "10.42.0.5:5000" outbound|5000||helloworld.default.svc.cluster.local 10.42.0.4:55914 10.43.135.30:5000 10.42.0.4:41438 - default | ||
... | ||
``` | ||
|
||
## Mesh Config | ||
|
||
```yaml | ||
spec: | ||
meshConfig: | ||
accessLogFile: /dev/stdout | ||
``` | ||
๋๋ | ||
```bash | ||
$ istioctl install --set meshConfig.accessLogFile=/dev/stdout | ||
``` | ||
|
||
## ๋๋ค ์จ๋ณด๊ธฐ | ||
|
||
์ผ๋จ Telemetry API ๋ฐฉ์๊ณผ Mesh Config ๋ฐฉ์ ๋๋ค ๋ ๋ฆฝ์ ์ด๋ค! ์ฒ์์ ๋๋ค ์ธํ ์ ํด์ผ ๋ก๊น ์ด ๋๋ ์ค ์์๋๋ฐ, ๊ทธ๊ฒ ์๋๋ผ ๋ ์ค ์ด๋ค ๋ฐฉ๋ฒ์ ์จ๋ Envoy Logging์ด ๋๋ค! | ||
|
||
๋ค๋ง, ์ฐจ์ด์ ์ Telemetry API๋ ๋ค์์คํ์ด์ค์ ์ํฌ๋ก๋ Selector๋ฅผ ํตํด ๋ก๊น ๋์์ ์ ํํ ์ ์์ด์ ์ข๋ ์ธ๋ฐํ(fine-grained) ๋ก๊ทธ ์ ์ด๊ฐ ๊ฐ๋ฅํ๋ค. | ||
|
||
... | ||
|
||
# Access Log Format | ||
|
||
Access Log๊ฐ ์ด๋ค ์ ๋ณด๋ค์ ๋ณด์ฌ์ฃผ๋์ง ์ข๋ ์ดํด๋ณด์. | ||
|
||
## inbound, outbound ๊ตฌ๋ถ ๊ฐ๋ฅ | ||
|
||
Envoy ์ฉ์ด๋ค ์ ๊น ์ ๋ฆฌ | ||
|
||
- upstream | ||
- host | ||
- cluster | ||
- local address | ||
- downstream | ||
- local address | ||
- remote address | ||
|
||
## Request ๊ธฐ๋ณธ ์ ๋ณด ํ์ธ ๊ฐ๋ฅ | ||
|
||
## Response ์ ๋ณด ํ์ธ ๊ฐ๋ฅ | ||
|
||
|
||
```bash | ||
[2024-03-18T23:08:48.020Z] "GET /hello HTTP/1.1" 200 - via_upstream - "-" 0 59 52 51 "-" "curl/8.6.0" "a0698764-a04d-48c8-8914-045808d19898" "helloworld.default.svc.cluster.local:5000" "10.42.0.4:5000" inbound|5000|| 127.0.0.6:60873 10.42.0.4:5000 10.42.0.6:48352 outbound_.5000_._.helloworld.default.svc.cluster.local default | ||
... | ||
[2024-03-18T23:10:51.528Z] "GET /hello HTTP/1.1" 200 - via_upstream - "-" 0 59 38 37 "-" "curl/7.88.1" "5c3abfa9-c806-490b-a5ec-a6659f866490" "helloworld.default.svc.cluster.local:5000" "10.42.0.5:5000" outbound|5000||helloworld.default.svc.cluster.local 10.42.0.4:55914 10.43.135.30:5000 10.42.0.4:41438 - default | ||
``` | ||
|
||
# ์ฐธ๊ณ ์๋ฃ | ||
|
||
- https://istio.io/latest/docs/tasks/observability/logs/access-log/ |