目的: 把 blah.foobar.com 的 CDN access log 轉送到 datadog 備查
0. Datadog
- 設定設定
- https://docs.datadoghq.com/integrations/akamai_datastream_2/
1. COMMON SERVICES - DataStream
- 點選 Create stream - Delivery Products
- CONFIGURATION
- Display Name: blah-foobar-com-logs-to-datadog
- Group: Foobar-W-DEADBF
- Include properties: 勾選 blah.foobar.com
- DATA SETS
- Log information
- (include all)
- Message exchange data
- (include all)
- Request header data
- (include all)
- Network performance data
- (include all)
- Cache data
- (include all)
- Geo data
- (include all)
- Web security
- (include all)
- EdgeWorkers
- (include all)
- Content protection
- (include all)
- Custom fields
- (include all)
- Log file
- Log format: Json
- DELIVERY
- Destination
- Destination: 選 Datadog
- Display name: blah-foobar-com-logs-to-datadog
- Endpoint: (datadog input endpoint)
- https://http-intake.logs.datadoghq.com/v1/input
- https://http-intake.logs.datadoghq.eu/v1/input
- Tags: source:akamai.datastream
- Source: akamai.datastream
- Service:
- API Key: (datadog api key)
- Send compressed data: No
- Delivery options
- Push frequency: 60 Seconds
- SUMMARY
- 幾個步驟建立完之後, blah-foobar-com-logs-to-datadog 的 status 是 Activating - V1
- 只能 View / History / Clone, 無法 Edit / Deactivate / Delete
- V1 是指這個 Stream 設定是 version 1, 不是 DataStream 1 的意思
2. CDN - Properties
- 選 blah.foobar.com 再點選版本, 點 Edit New Version
- 左邊選 Default Rule, 右邊點 +Behavior 新增 DataStream
- Stream version 只有選 DataStream 2 會過
- DataStream 1 要被淘汰掉
- 選 DataStream 1 會跳出警告訊息, 可以 Save 但無法 Activate
- Stream names 選 blah-foobar-com-logs-to-datadog
- Sample rate 預設 100
- 通靈用的話一定要選 100, 要不然缺 log 會讓你通到屎
- 最後 Save
- 然後 Activate 這個新版本上線
- 最久 10 分鐘才會完成
3. 回到 COMMON SERVICES - DataStream
- blah-foobar-com-logs-to-datadog 的 status 在 Properties 上完之後變成 Active - V1
- 第一次比較快
- Active 狀態才可以 Edit / Deactivate
- 要 Delete 的話, 要先 Deactivate 讓狀態變成 Deactived 才能 Delete
- 無論是 Edit / Deactivate, 最久 60 分鐘才會生效