##dz-db-collector-details
Configuring the Fastly logging endpoint
Follow the steps Adding HTTPS as a logging endpoint from the Fastly Documentation
Here are the configuration details:
URL |
https://streaming.datazoom.io/cdn/v1/logs |
Content-Type |
application/json |
Custom Header Name |
X-Api-Key |
Custom Header Value |
API key from above |
Method |
POST |
JSON log entry format |
Array of JSON |
Log Line format |
Blank |
Placement |
Format Version Default |
See our section on Configuring CDN logs to accept the Datazoom Session ID for additional steps to include the Datazoom Session ID in your Fastly logs. Also see our section on Setting Custom Request Headers for options on how to pass the Datazoom Session ID as a Request Header item.
Example Log Format:
{
"time":%{time.start.sec}V,
"event": {
"service_id":"%{req.service_id}V",
"time_start":"%{begin:%Y-%m-%dT%H:%M:%S%Z}t",
"time_end":"%{end:%Y-%m-%dT%H:%M:%S%Z}t",
"time_elapsed":%D,
"client_as_number":%{client.as.number}V,
"client_city":"%{client.geo.city}V",
"client_congestion_algorithm":"%{client.socket.congestion_algorithm}V",
"client_country_code":"%{client.geo.country_code3}V",
"client_cwnd":%{client.socket.cwnd}V,
"client_delivery_rate":%{client.socket.tcpi_delivery_rate}V,
"client_ip":"%{req.http.fastly-client-ip}V",
"client_latitude":%{if(client.geo.latitude == 999.9, "null", client.geo.latitude)}V,
"client_longitude":%{if(client.geo.longitude == 999.9, "null", client.geo.longitude)}V,
"client_ploss":%{client.socket.ploss}V,
"client_requests":%{client.requests}V,
"client_retrans":%{client.socket.tcpi_delta_retrans}V,
"client_rtt":%{req.http.log-client:tcpi_rtt}V,
"client_region":"%{client.geo.region}V",
"content_type":"%{Content-Type}o",
"fastly_is_edge":%{if(fastly.ff.visits_this_service == 0, "true", "false")}V,
"fastly_is_shield":%{if(req.http.log-origin:shield == server.datacenter, "true", "false")}V,
"fastly_pop":"%{server.datacenter}V",
"fastly_server":"%{server.hostname}V",
"fastly_shield_used":%{if(req.http.log-origin:shield, "%22" + req.http.log-origin:shield + "%22", "null")}V,
"origin_host":%{if(req.http.log-origin:host,"%22" + json.escape(req.http.log-origin:host) + "%22","null")}V,
"origin_ip":%{if(req.http.log-origin:ip,"%22" + json.escape(req.http.log-origin:ip) + "%22","null")}V,
"origin_method":%{if(req.http.log-origin:method,"%22" + json.escape(req.http.log-origin:method) + "%22","null")}V,
"origin_name":%{if(req.http.log-origin:name,"%22" + json.escape(req.http.log-origin:name) + "%22","null")}V,
"origin_port":%{if(req.http.log-origin:port,req.http.log-origin:port,"null")}V,
"origin_reason":%{if(req.http.log-origin:reason,"%22" + json.escape(req.http.log-origin:reason) + "%22","null")}V,
"origin_status":%{if(req.http.log-origin:status,json.escape(req.http.log-origin:status),"null")}V,
"origin_ttfb":%{if(req.http.log-origin:ttfb == "NaN", "null", req.http.log-origin:ttfb)}V,
"origin_ttlb":%{if(req.http.log-origin:ttlb == "NaN", "null", req.http.log-origin:ttlb)}V,
"origin_url":%{if(req.http.log-origin:url,"%22" + json.escape(req.http.log-origin:url) + "%22","null")}V,
"request_host":"%{json.escape(req.http.log-request:host)}V",
"request_is_h2":%{if(fastly_info.is_h2, "true", "false")}V,
"request_is_ipv6":%{if(req.is_ipv6, "true", "false")}V,
"request_method":"%{json.escape(req.http.log-request:method)}V",
"request_tls_version":%{if(tls.client.protocol, "%22" + tls.client.protocol + "%22", "null")}V,
"request_url":"%{json.escape(req.http.log-request:url)}V",
"request_user_agent":%{if(req.http.user-agent, "%22" + json.escape(req.http.user-agent) + "%22", "null")}V,
"response_age":%{regsub(obj.age, ".000$", "")}V,
"response_bytes_body":%{resp.body_bytes_written}V,
"response_bytes_header":%{resp.header_bytes_written}V,
"response_bytes":%{resp.bytes_written}V,
"response_cache_control":%{if(resp.http.cache-control, "%22" + json.escape(resp.http.cache-control) + "%22", "null")}V,
"response_completed":%{if(resp.completed, "true", "false")}V,
"response_content_length":%{if(resp.http.content-length, resp.http.content-length, "null")}V,
"response_content_type":%{if(resp.http.content-type, "%22" + json.escape(resp.http.content-type) + "%22", "null")}V,
"response_reason":%{if(resp.response,"%22" + json.escape(resp.response) + "%22","null")}V,
"response_state":"%{fastly_info.state}V",
"response_status":%{resp.status}V,
"response_ttfb":%{req.http.log-response:ttfb}V,
"response_ttl":%{obj.ttl}V,
"response_ttlb":%{req.http.log-response:ttlb}V,
"response_x_cache":%{if(resp.http.x-cache,"%22" + json.escape(resp.http.x-cache) + "%22","null")}V
}
}
Comments
0 comments
Article is closed for comments.