๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๐Ÿ”Ž Service Mesh

[Service Mesh] 7. Logging

by Seongpyo Hong 2021. 1. 28.

Service Mesh ์•Œ์•„๋ณด๊ธฐ

  1. [Service Mesh] 1. Service Mesh๋ž€?
  2. [Service Mehs] 2. Envoy Proxy
  3. [Service Mesh] 3. Istio?
  4. [Service Mesh] 4. Istio Traffic Management (1) - Virtual Service & Destination Rule
  5. [Service Mesh] 5. Istio Traffic Managerment (2) - Gateway & Service Entry
  6. [Service Mesh] 6. Service Monitoring in Istio
  7. [Service Mesh] 7. Logging

์ด๋ฒˆ์‹œ๊ฐ„์—๋Š” ์„œ๋น„์Šค ๋ฉ”์‹œ ๋‚ด๋ถ€ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋กœ๊ทธ๋ฅผ Istio์—์„œ ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•˜๋Š”์ง€์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Kubernetes Cluster์— ๋ฐฐํฌ๋œ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ƒํƒœ๋ฅผ ์ถ”์ ํ•˜๊ณ  ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋กœ๊ทธ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜๊ณ  ์ด๋ฅผ ๋ถ„์„ํ•˜๋Š” ๊ณผ์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ๋กœ๊ทธ์˜ ์ข…๋ฅ˜๋กœ๋Š” ์‹œ์Šคํ…œ ๋กœ๊ทธ๋‚˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ๋ฐœ์ƒํ•˜๋Š” ๋กœ๊ทธ, ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์— ์—‘์„ธ์Šคํ•˜๋Š” ๋กœ๊ทธ์™€ ๊ฐ™์ด ๋‹ค์–‘ํ•˜๊ฒŒ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค.

์ด ์ค‘ ์—‘์„ธ์Šค ๋กœ๊ทธ๋Š” ์„œ๋น„์Šค ๋ฉ”์‹œ ์•„ํ‚คํ…์ณ์— ๋ฐฐํฌ๋˜๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ๋ชจ๋“  ํ†ต์‹ ์ด  Envoy Sidecar๋ฅผ ํ†ตํ•ด ์ด๋ฃจ์–ด์ง€๊ณ , ์ด๋Š” Istio์—์„œ ๊ด€๋ฆฌ๋˜๊ธฐ ๋•Œ๋ฌธ์— ์š”์ฒญ ๋ฐ ์—‘์„ธ์Šค ๊ณผ์ •์„ ์ถ”์ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Service Metric ์ˆ˜์ง‘๊ณผ ๋™์ผํ•˜๊ฒŒ Mixer๊ฐ€ ์กด์žฌํ–ˆ๋˜ Istio 1.8 ๋ฒ„์ „ ์ด์ „์˜ ๊ฒฝ์šฐ์—๋Š” Adapter๋ฅผ ํ†ตํ•ด Logging Backend๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์™€ ๋‹ฌ๋ฆฌ Mixer๊ฐ€ Deprecated ๋œ Istio 1.8 ๋ฒ„์ „ ์ดํ›„์—๋Š” WASM์„ ํ†ตํ•ด Envoy ๋‚ด๋ถ€์—์„œ ์ด๋Ÿฐ ๊ณผ์ •๋“ค์ด ์ด๋ฃจ์–ด์ง€๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์ด๋ฒˆ ๊ธ€์—์„œ๋Š” ๋‘๊ฐ€์ง€ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.


EFK Stack

์ด ๊ธ€์„ ์ฐธ๊ณ ํ•˜๋ฉด ๋กœ๊ทธ๋ฅผ ์ˆ˜์ง‘ ๋ฐ ์ „์†กํ•˜๊ธฐ ์œ„ํ•œ Fluentd, ์ €์žฅ์„ ์œ„ํ•œ Elasticsearch, ์กฐํšŒ๋ฅผ ์œ„ํ•œ Kibana๋ฅผ ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ๋Š” manifest๊ฐ€ ์กด์žฌํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด EFK Stack์„ Kubernetes Cluster์— ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์„ค์ •๊ณผ ๊ด€๋ จ๋œ ๋ถ€๋ถ„์€ ๋”ฐ๋กœ ๋‹ค๋ฃจ์ง€ ์•Š๊ฒ ์Šต๋‹ˆ๋‹ค.


Logging (with Mixer)

Metric์„ ์ˆ˜์ง‘ํ–ˆ๋˜ ๊ฒƒ๊ณผ ๊ฐ™์ด Istio 1.8 ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” Mixer๋ฅผ ํ™œ์šฉํ•˜์—ฌ Access Logging์„ ์ฒ˜๋ฆฌํ•˜์˜€์Šต๋‹ˆ๋‹ค. ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์—‘์„ธ์Šค ๋กœ๊ทธ๋ฅผ ์ˆ˜์ง‘ํ•ด์•ผํ•˜๋Š” ์ƒํ™ฉ์„ ๊ฐ€์ •ํ–ˆ์„ ๋•Œ ํ•ด๋‹นํ•˜๋Š” ๋กœ๊ทธ ๋ฐ์ดํ„ฐ๋ฅผ ์ˆ˜์ง‘ํ•˜์—ฌ ๋กœ๊น… ๋ฐฑ์—”๋“œ๋กœ ์ „์†กํ•˜๊ธฐ ์œ„ํ•œ Adapter๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.  

Adapter๋ฅผ ๊ตฌ์„ฑํ•˜๊ธฐ ์œ„ํ•œ Handler, Instance, Rule ์—ญํ• ์— ๋Œ€ํ•œ ์„ค๋ช…์€ ์ด์ „ ๊ธ€์—์„œ ํ™•์ธํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. 

# Configuration for logentry instances
apiVersion: config.istio.io/v1alpha2
kind: instance
metadata:
  name: newlog
  namespace: istio-system
spec:
  compiledTemplate: logentry
  params:
    severity: '"info"'
    timestamp: request.time
    variables:
      source: source.labels["app"] | source.workload.name | "unknown"
      user: source.user | "unknown"
      destination: destination.labels["app"] | destination.workload.name | "unknown"
      responseCode: response.code | 0
      responseSize: response.size | 0
      latency: response.duration | "0ms"
    monitored_resource_type: '"UNSPECIFIED"'
---
# Configuration for a Fluentd handler
apiVersion: config.istio.io/v1alpha2
kind: handler
metadata:
  name: handler
  namespace: istio-system
spec:
  compiledAdapter: fluentd
  params:
    address: "fluentd-es.logging:24224"
---
# Rule to send logentry instances to the Fluentd handler
apiVersion: config.istio.io/v1alpha2
kind: rule
metadata:
  name: newlogtofluentd
  namespace: istio-system
spec:
  match: "true" # match for all requests
  actions:
   - handler: handler
     instances:
     - newlog
---
  • timestamp ํ•„๋“œ์— ๋Œ€์ž…๋˜๋Š” request.time์€ envoy์—์„œ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค. 
  • Instance์˜ Variable์— ์„ ์–ธ๋˜๋Š” ๋ฐ์ดํ„ฐ์˜ ์ข…๋ฅ˜๋Š” ์ด ๊ธ€์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Handler์˜ compiledAdapter๋Š” Fluentd Adapter๋ฅผ ์˜๋ฏธํ•˜๊ณ , address์—์„œ ๊ตฌ๋™ ์ค‘์ธ fluentd Daemon์— ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•ฉ๋‹ˆ๋‹ค.

์œ„์˜ Adapter๋ฅผ ํ†ตํ•ด ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ ‘๊ทผ ๋กœ๊ทธ๋ฅผ Fluentd Daemon์— ์ „์†กํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


Logging (with WASM)

  ์ด๋ฒˆ์—๋Š” Mixer๊ฐ€ Deprecated ๋œ ์ดํ›„ WASM์„ ํ†ตํ•ด ์–ด๋–ป๊ฒŒ ์œ„์˜ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ๋จผ์ € WASM Plugin์„ ๊ฐœ๋ฐœํ•˜๊ธฐ ์ด์ „์— Fluentd Adapter๊ฐ€ ํ•˜๋Š” ์—ญํ• ์„ ํ•œ ๋ฒˆ ์งš์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. Fleuntd Adapter๋Š” ์ˆ˜์‹ ํ•œ Envoy Attribute๋ฅผ ํ†ตํ•ด ๋กœ๊ทธ ๋ฐ์ดํ„ฐ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ์ด๋ฅผ fluentd Daemon์— ๋ณด๋‚ด๋Š” ์—ญํ• ์„ ๋‹ด๋‹นํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ WASM Plugin์—์„œ ์ˆ˜ํ–‰ํ•  ์ž‘์—…์€ Log Data๋ฅผ ์ƒ์„ฑํ•˜์—ฌ ์ด๋ฅผ Fluentd Daemon์— ์ „์†กํ•˜๋Š” ์ž‘์—…์ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ์ œ๊ฐ€ ์žˆ์—ˆ๋˜ metric๊ณผ๋Š” ๋‹ค๋ฅด๊ฒŒ logging์— ๋Œ€ํ•œ ์˜ˆ์‹œ๋Š” ์—†๊ธฐ ๋•Œ๋ฌธ์— proxy-wasm-go-sdk์˜ ๋ฉ”์„œ๋“œ๋“ค์„ ์ฐพ์•„๋ณด๋ฉฐ ์ง„ํ–‰ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

์ง„ํ–‰ํ•˜๋ฉฐ ๊ฐ€์žฅ ์–ด๋ ค์› ๋˜ ์ ์€ Custom Log Metric์„ ์–ด๋–ป๊ฒŒ ์ƒ์„ฑํ•˜๋Š”์ง€์— ๋Œ€ํ•œ ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค. logentry variable ํ•„๋“œ์—์„œ ์ •์˜ํ–ˆ๋˜ source.labels, response.code์™€ ๊ฐ™์€ ๋ฐ์ดํ„ฐ๋“ค์„ ์–ด๋–ป๊ฒŒ ์–ป์„ ์ˆ˜ ์žˆ๋Š”์ง€์— ๋Œ€ํ•ด์„œ ๋ฌธ์„œ๋ฅผ ํ™•์ธํ•ด๋ณด๋ฉด ์œ„์—์„œ ์‚ฌ์šฉ๋œ ๋ฐ์ดํ„ฐ๋“ค์„ ๋ฏธ๋ฆฌ ํ‚ค์›Œ๋“œ๋กœ ์ •์˜ํ•ด๋†“๊ณ  ์ด๋ฅผ Attribute Vocabulary๋ผ๊ณ  ํ•˜๋ฉฐ Envoy๋‚˜ Mixer์˜ Adapter์—์„œ ์ƒ์„ฑ๋œ๋‹ค๊ณ  ๋ช…์‹œ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, Istio Deployment๋Š” ์ด๋Ÿฐ Attribute Vocabulary๋ฅผ ์ƒ์„ฑํ•˜๋Š” agent๊ฐ€ ์กด์žฌํ•œ๋‹ค๊ณ  ๋‚˜์™€์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ Telemetry V2๋Š” K8S Metadata์— ์ ‘๊ทผํ•˜๊ธฐ ์œ„ํ•œ Mixer๊ฐ€ ์‚ฌ๋ผ์กŒ๊ธฐ ๋•Œ๋ฌธ์— metadata์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๋ฅผ Envoy Proxy ์ž์ฒด์ ์œผ๋กœ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ด๋ฅผ ์œ„ํ•ด ๋จผ์ € ์•Œ์•„์•ผ ํ•˜๋Š” ์ ์€ ์–ด๋–ค Envoy Attribute๊ฐ€ ์กด์žฌํ•˜๊ณ , ์ด๋ฅผ WASM Plugin์—์„œ ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š”์ง€์— ๋Œ€ํ•œ ๋ถ€๋ถ„์ž…๋‹ˆ๋‹ค. ์ €๋Š” ์ด๊ฑฐ๋ฅผ ์ฐพ๋Š”๋ฐ ์• ๋ฅผ ๋จน์–ด Stackoverflow์— ์งˆ๋ฌธ๊นŒ์ง€ ํ–ˆ๋Š”๋ฐ ๋‹คํ–‰ํžˆ ๊ธˆ๋ฐฉ ๋„์›€์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

Thanks to Jakub...

์œ„์˜ ๋‚ด์šฉ์„ ๋ณด๋ฉด Envoy์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐ์ดํ„ฐ์˜ ๋ชฉ๋ก์€ Attributes ๋ฌธ์„œ์—์„œ ํ™•์ธํ•  ์ˆ˜ ์žˆ๊ณ , ์ด ๊ธ€์˜ ๋งˆ์ง€๋ง‰ ๋ถ€๋ถ„์˜ Path Expressions ๋ถ€๋ถ„์„ ๋ณด๋ฉด WASM ABI์—์„œ ์–ด๋–ป๊ฒŒ ๊ฐ’์„ ์–ป์„ ์ˆ˜ ์žˆ๋Š”์ง€ ๋‚˜ํƒ€๋‚˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, proxy-wasm-go-sdk์˜ PR์„ ๋ณด๋ฉด 2020๋…„ 9์›”์— get_property ๊ธฐ๋Šฅ์ด ์ถ”๊ฐ€๋œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


WASM Plugin

๋จผ์ € get_property ํ•จ์ˆ˜๋ฅผ ํ™•์ธํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. 

func GetProperty(path []string) ([]byte, error) {
	var ret *byte
	var retSize int
	raw := SerializePropertyPath(path)

	err := types.StatusToError(rawhostcall.ProxyGetProperty(&raw[0], len(raw), &ret, &retSize))
	if err != nil {
		return nil, err
	}

	return RawBytePtrToByteSlice(ret, retSize), nil

}

 

Parameter๋กœ ๋ฐ›๋Š” path์— Envoy Attributes์˜ ๊ฒฝ๋กœ๋Š” ์ž…๋ ฅํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ๊ฐ’์„ ์–ป์–ด์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


์ด๋ฅผ ํ†ตํ•ด์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ Http ์š”์ฒญ์œผ๋กœ๋ถ€ํ„ฐ ๊ฐ’์„ ๋ฐ›์•„์˜ค๊ฑฐ๋‚˜ connections์— ๊ด€ํ•œ ์ •๋ณด ๋“ฑ์„ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์˜ค๋Š” ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

package main

import (
	"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm"
	"github.com/tetratelabs/proxy-wasm-go-sdk/proxywasm/types"
)

func main() {
	proxywasm.SetNewRootContext(newRootContext)
	proxywasm.SetNewHttpContext(newHttpContext)
}

type httpLogRootContext struct {
	proxywasm.DefaultRootContext
	contextID uint32
}

func newRootContext(contextID uint32) proxywasm.RootContext {
	return &httpLogRootContext{contextID: contextID}
}

// override
func (ctx *httpLogRootContext) OnVMStart(vmConfigurationSize int) bool {
	path := []string{"cluster_name"}
	result, err := proxywasm.GetProperty(path)
	if err != nil {
		proxywasm.LogCritical("failed to get property in envoy.")
	} else {
		proxywasm.LogInfo("Node Info  : " + string(result))
	}
	return true
}

type logHttpContext struct {
	proxywasm.DefaultHttpContext
}

func newHttpContext(uint32, uint32) proxywasm.HttpContext {
	return &logHttpContext{}
}

// override
func (ctx *logHttpContext) OnHttpRequestHeaders(numHeaders int, endOfStream bool) types.Action {
	pathMethod := []string{"request", "method"}
	methodResult, _ := proxywasm.GetProperty(pathMethod)
	proxywasm.LogInfo("Request Method  : " + string(methodResult))

	connectionPath := []string{"source", "address"}
	connectionResult, _ := proxywasm.GetProperty(connectionPath)
	proxywasm.LogInfo("Source Address :" + string(connectionResult))

	return types.ActionContinue
}

๊ฐ„๋‹จํ•˜๊ฒŒ ์ฝ”๋“œ๋ฅผ ์‚ดํŽด๋ณด๋ฉด OnVMStart ํ•จ์ˆ˜๋Š” ์ดˆ๊ธฐ ์‹คํ–‰ ์‹œ ์ˆ˜ํ–‰๋˜๊ณ , OnHttpRequestHeaders ํ•จ์ˆ˜๋Š” HTTP ์š”์ฒญ์ด ๋“ค์–ด์™”์„ ๋•Œ ์ˆ˜ํ–‰์ด ๋ฉ๋‹ˆ๋‹ค.  ์ด ๋•Œ ์‚ฌ์šฉํ•  Context๋ฅผ main ํ•จ์ˆ˜์—์„œ ์ •์˜ํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ˆ˜ํ–‰๋ฉ๋‹ˆ๋‹ค.


์œ„ ์ฝ”๋“œ์˜ ์‹คํ–‰ ๊ฒฐ๊ณผ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

//Start
starting main dispatch loop
wasm log my_root_id: failed to get property in envoy.

// HTTP Request In
wasm log: Request Method : GET
wasm log: Source Address :127.0.0.1:58181

์‹คํ–‰ ๊ฒฐ๊ณผ๋ฅผ ๋ณด๋ฉด OnVMStart์—์„œ ํ˜ธ์ถœ๋œ cluster_name์— ๋Œ€ํ•ด ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค์ง€ ๋ชปํ•œ ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด์™€ ๊ด€๋ จํ•ด์„œ ์•„์ง sdk์˜ ๊ตฌ์กฐ๋ฅผ ์™„๋ฒฝํ•˜๊ฒŒ ํŒŒ์•…ํ•˜์ง€๋Š” ๋ชปํ–ˆ์ง€๋งŒ ์ œ๊ฐ€ ์ •๋ฆฌํ•œ ๋ฐ”๋Š” 

  • ์—ฌ๋Ÿฌ๊ฐ€์ง€ Envoy Attribute๋ฅผ ํ…Œ์ŠคํŠธ ํ•œ ๊ฒฐ๊ณผ ๊ฐ Attribute๋Š” ๊ฐ€์ ธ์˜ฌ ์ˆ˜ ์žˆ๋Š” ์‹œ์ ์ด ์กด์žฌํ•˜๊ณ  ์ด ์‹œ์ ์€ Context์™€ On--- Method๋กœ ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค.
  • On---Method์—์„œ๋Š” HttpHeader ๋ฐ Up/DownStream / Connection๊ณผ ๊ฐ™์€ ๋‹ค์–‘ํ•œ ์ด๋ฒคํŠธ ๋ฐœ์ƒ๊ณผ ๋Œ€์‘๋˜๋ฉฐ ์ด ๋•Œ ์ˆ˜ํ–‰ํ•  ํ–‰๋™์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์œ„์˜ ๊ณผ์ •์„ ํ†ตํ•ด Envoy Attribute์—์„œ ์›ํ•˜๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์–ป์–ด์˜ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฐ์ดํ„ฐ๋ฅผ Fleuntd Daemon์— ๋ณด๋ƒ„์œผ๋กœ์จ Mixer Adapter๊ฐ€ ์ˆ˜ํ–‰ํ•˜๋Š” ๊ธฐ๋Šฅ์„ Envoy Proxy ์ž์ฒด๊ฐ€ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ƒ์„ฑํ•œ ๋กœ๊ทธ ๋ฐ์ดํ„ฐ๋ฅผ Fluentd Daemon์— ์ „์†กํ•˜๋Š” ์ž‘์—…์— ๋Œ€ํ•ด์„œ๋„ ์ง„ํ–‰ํ–ˆ์–ด์•ผ ํ•˜์ง€๋งŒ TCP Socket์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ „์†กํ•˜๋Š” WASM ABI๋ฅผ ์ฐพ์ง€ ๋ชปํ•ด์„œ ์ด ๋ถ€๋ถ„์€ ์ข€ ๋” ์ฐพ์•„๋ณธ ํ›„ ๋‹ค์Œ ๊ธ€๋กœ ์ž‘์„ฑํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค...

๋งˆ์น˜๋ฉฐ

์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” Mixer๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Access Log๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ๋ฐฉ๋ฒ•๊ณผ WASM๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Custom Log๋ฅผ ์ˆ˜์ง‘ํ•˜๋Š” ๊ณผ์ •์˜ ์ผ๋ถ€..(Envoy Attribute ์—์„œ ๋ฐ์ดํ„ฐ ์ˆ˜์ง‘)๋ฅผ ์ง„ํ–‰ํ–ˆ์Šต๋‹ˆ๋‹ค. ๋ฌผ๋ก  ์ €๋Š” WASM์— ๋Œ€ํ•ด ์ž˜ ์•Œ์ง€ ๋ชปํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ œ๊ฐ€ ์ž‘์„ฑํ•œ ๋ฐฉ๋ฒ•๋“ค์ด ์‹ค์ œ๋กœ ์‚ฌ์šฉ๋˜๊ธฐ๋Š” ํž˜๋“ค๊ณ  ๊ทธ์ € ๋™์ž‘ํ•˜๋Š” ๋ฐฉ์‹์„ ์ดํ•ดํ•˜๊ธฐ ์œ„ํ•œ ์ •๋„๋กœ๋งŒ ์ƒ๊ฐํ•˜์‹œ๋ฉด ๋  ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค. 

์ง€๊ธˆ๊นŒ์ง€์˜ ๊ธ€์„ ํ†ตํ•ด Service Mesh ์•„ํ‚คํ…์ณ ๋ฐ Istio์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋Š” ์‹œ๊ฐ„์„ ๊ฐ€์ ธ๋ณด์•˜์Šต๋‹ˆ๋‹ค. ๊ณต๋ถ€๋ฅผ ํ•˜๋ฉด์„œ ๋Š๊ผˆ๋˜ ๋ถ€๋ถ„์€ ์•„์ง ๋ฌธ์„œํ™”๊ฐ€ ๋œ ๋œ ๋ถ€๋ถ„๋“ค๋„ ์žˆ๊ณ , ๋ฒ„์ „์— ๋”ฐ๋ผ ๋งŽ์€ ๋ถ€๋ถ„๋“ค์ด ๋ณ€ํ•˜๋Š” ์ƒํ™ฉ์ธ์ง€๋ผ ์›ํ•˜๋Š” ์ •๋ณด๋ฅผ ์ฐพ๊ธฐ ์กฐ๊ธˆ ์–ด๋ ต๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ, ๋ถ„๋ช… ์ธํ”„๋ผ ๋ ˆ๋ฒจ์—์„œ ์ฒ˜๋ฆฌํ•˜๋Š” ๊ฒƒ์— ๋Œ€ํ•ด ์žฅ์ ์ด ์กด์žฌํ•˜์ง€๋งŒ, ์ด๋ฅผ ์ ์šฉํ•จ์œผ๋กœ์จ ๊ธฐ์กด์˜ Server - Client์˜ ์‚ฌ์ด์— ๋˜ ํ•˜๋‚˜์˜ ๊ณ„์ธต์ด ์ถ”๊ฐ€๋˜๊ธฐ ๋•Œ๋ฌธ์— ๊ด€๋ฆฌํ•ด์•ผํ•  ํฌ์ธํŠธ๊ฐ€ ์ฆ๊ฐ€ํ•˜๊ฒŒ ๋œ๋‹ค๋Š” ์ ์ž…๋‹ˆ๋‹ค. ๋ชจ๋“  ๊ธฐ์ˆ ์— ์žฅ์ ๋งŒ ์กด์žฌํ•˜์ง€ ์•Š๊ธฐ์— Istio ๋ฐ envoy์˜ ์•ˆ์ •์„ฑ์— ๋Œ€ํ•œ ๊ฒ€์ฆ๋„ ๋ถ„๋ช… ํ•„์š”ํ•˜๋‹ค๋Š” ์ƒ๊ฐ์ด ๋“ค์—ˆ์Šต๋‹ˆ๋‹ค. 

์ง€๊ธˆ๊นŒ์ง€ ๊ธ€์„ ์ฝ์–ด์ฃผ์…”์„œ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค. ์ˆ˜์ •์ด ํ•„์š”ํ•˜๊ฑฐ๋‚˜ ๋” ๋‚˜์€ ์˜๊ฒฌ์ด ์žˆ๋‹ค๋ฉด ์–ธ์ œ๋“ ์ง€ ํ”ผ๋“œ๋ฐฑ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค :)


์ฐธ๊ณ ์ž๋ฃŒ

Envoy Attribute

Stackoverflow

Istio EFK Stack

Istio Mixer Overview

 

 

๋Œ“๊ธ€