Once you've setup your video player to include the Datazoom-ID
in content requests, you will need your CDN to include that data in their response logs.
Instructions for Fastly
PART 1- Configuring the Fastly logs
Fastly provides clear documentation on how to modify your logs. Please take a minute to review the Fastly doc: Adding or modifying headers on HTTP requests and responses.
- Log in to the Fastly web interface and click the Configure link.
- From the service menu, select the appropriate service.
- Click the Configuration button and then select Clone active. The Domains page appears.
- Click the Content link. The Content page appears.
- Click the Create header button. The Create a header window appears.
- Specific to Datazoom, here is an example Custom Response header:
- Name:
Your Header Name
- Type/Action:
Response
Set
- Destination:
http.Datazoom-ID
- Source:
req.http.Datazoom-ID
- Ignore if set:
No
- Priority:
10
- Name:
- Click the Create button.
- Click the Activate button to deploy your configuration changes.
PART 2- Configuring Fastly to send logs
Now that you've configured Fastly to log the Datazoom-ID
, you'll need to send those logs to a destination where the Fastly and Datazoom data sets can be time-aligned and queried. Fastly provides clear documentation on how to configure their real-time log streaming product. Please take a minute to review the Fastly docs, Setting up remote log streaming and Log streaming: Splunk.
As you setup your destination in the Fastly setup screen, you will be asked to include a Log Format. In order to include the Datazoom-ID
that you'll need to include this line: "Datazoom-ID":"%{req.http.Datazoom-ID}V"
Below is an example Log Format that includes the Datazoom-ID
as the last line.
{ "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_ip":"%h", "timestamp":"%{begin:%Y-%m-%d %H:%M:%S}t.%{time.start.usec_frac}V", "client_as_name":"%{client.as.name}V", "client_as_number":"%{client.as.number}V", "client_connection_speed":"%{client.geo.conn_speed}V", "request":"%m", "protocol":"%H", "host":"%{Fastly-Orig-Host}i", "origin_host":"%v", "url":"%{cstr_escape(req.url)}V", "is_ipv6":%{if(req.is_ipv6, "true", "false")}V, "is_tls":%{if(req.is_ssl, "true", "false")}V, "tls_client_protocol":"%{cstr_escape(tls.client.protocol)}V", "tls_client_servername":"%{cstr_escape(tls.client.servername)}V", "tls_client_cipher":"%{cstr_escape(tls.client.cipher)}V", "tls_client_cipher_sha":"%{cstr_escape(tls.client.ciphers_sha )}V", "tls_client_tlsexts_sha":"%{cstr_escape(tls.client.tlsexts_sha)}V", "is_h2":%{if(fastly_info.is_h2, "true", "false")}V, "is_h2_push":%{if(fastly_info.h2.is_push, "true", "false")}V, "h2_stream_id":"%{fastly_info.h2.stream_id}V", "request_referer":"%{Referer}i", "request_user_agent":"%{User-Agent}i", "request_accept_content":"%{Accept}i", "request_accept_language":"%{Accept-Language}i", "request_accept_encoding":"%{Accept-Encoding}i", "request_accept_charset":"%{Accept-Charset}i", "request_connection":"%{Connection}i", "request_dnt":"%{DNT}i", "request_forwarded":"%{Forwarded}i", "request_via":"%{Via}i", "request_cache_control":"%{Cache-Control}i", "request_x_requested_with":"%{X-Requested-With}i", "request_x_att_device_id":"%{X-ATT-Device-Id}i", "request_x_forwarded_for":"%{X-Forwarded-For}i", "status":"%s", "http_status_message":"%{resp.response}V", "restarts":%{req.restarts}V, "content_type":"%{Content-Type}o", "cache_status":"%{regsub(fastly_info.state, "^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*", "\\2\\3")}V", "fastly_state":"%{fastly_info.state}V", "response_time":%{time.elapsed.msec}V, "server_id":"%{server.identity}V", "cache_tier":"%{if(req.http.Fastly-FF, "shield", "edge")}V", "is_cacheable":%{if(fastly_info.state ~"^(HIT|MISS)$", "true", "false")}V, "response_age":"%{Age}o", "response_cache_control":"%{Cache-Control}o", "response_expires":"%{Expires}o", "response_last_modified":"%{Last-Modified}o", "response_tsv":"%{TSV}o", "server_datacenter":"%{server.datacenter}V", "server_ip":"%A", "geo_city":"%{client.geo.city.utf8}V", "geo_country_code":"%{client.geo.country_code}V", "geo_continent_code":"%{client.geo.continent_code}V", "geo_region":"%{client.geo.region}V", "req_header_size":%{req.header_bytes_read}V, "req_body_size":%{req.body_bytes_read}V, "resp_header_size":%{resp.header_bytes_written}V, "resp_body_size":%B, "socket_cwnd":%{client.socket.cwnd}V, "socket_nexthop":"%{client.socket.nexthop}V", "socket_tcpi_rcv_mss":%{client.socket.tcpi_rcv_mss}V, "socket_tcpi_snd_mss":%{client.socket.tcpi_snd_mss}V, "socket_tcpi_rtt":%{client.socket.tcpi_rtt}V, "socket_tcpi_rttvar":%{client.socket.tcpi_rttvar}V, "socket_tcpi_rcv_rtt":%{client.socket.tcpi_rcv_rtt}V, "socket_tcpi_rcv_space":%{client.socket.tcpi_rcv_space}V, "socket_tcpi_last_data_sent":%{client.socket.tcpi_last_data_sent}V, "socket_tcpi_total_retrans":%{client.socket.tcpi_total_retrans}V, "socket_tcpi_delta_retrans":%{client.socket.tcpi_delta_retrans}V, "socket_ploss":%{client.socket.ploss}V, "Datazoom-ID":"%{req.http.Datazoom-ID}V" } }
Comments
0 comments
Article is closed for comments.