Log streaming: Honeycomb

Fastly's Real-Time Log Streaming feature can send logs in JSON format to Honeycomb. Honeycomb is a tool that allows developers to explore the operations of complex systems, microservices, and databases.

NOTE

Fastly does not provide direct support for third-party services. Read Fastly's Terms of Service for more information.

Prerequisites

Before adding Honeycomb as a logging endpoint for Fastly services, you'll need to perform the following steps:

  • Sign up for a Honeycomb account if you don't already have one.
  • Obtain the Write Key for your team on the Honeycomb Account page.
  • Choose a Dataset name. If you plan to collect data from multiple environments (like production, development, staging), Honeycomb recommends creating a Dataset for each environment and naming your Datasets accordingly (e.g., prod.queries, dev.queries, and staging.queries). If a Dataset doesn't exist, Honeycomb will create one automatically.

Adding Honeycomb as a logging endpoint

  1. Deliver services
  2. Compute services
  1. Review the information in our guide to setting up remote log streaming.
  2. In the Honeycomb area, click Create endpoint.
  3. Fill out the Create a Honeycomb endpoint fields as follows:
    • In the Name field, enter a human-readable name for the endpoint.
    • In the Placement area, select where the logging call should be placed in the generated VCL. Valid values are Format Version Default, waf_debug (waf_debug_log), and None. Read our guide on changing log placement for more information.
    • In the Log format field, enter the data to send to Honeycomb. See the example format section for details.
    • In the Write Key field, enter the write key for your Honeycomb team. This is available on the Honeycomb Account page.
    • In the Dataset field, enter the name of the Honeycomb Dataset (e.g., myDataset).
  4. Click Create to create the new logging endpoint.
  5. Click Activate to deploy your configuration changes.

Example format

Data sent to Honeycomb must be serialized as a JSON object. Here's an example format string for sending data to Honeycomb:

1{
2 "time":"%{begin:%Y-%m-%dT%H:%M:%SZ}t",
3 "data": {
4 "service_id":"%{req.service_id}V",
5 "time_elapsed":%D,
6 "request":"%m",
7 "host":"%{if(req.http.Fastly-Orig-Host, req.http.Fastly-Orig-Host, req.http.Host)}V",
8 "url":"%{cstr_escape(req.url)}V",
9 "protocol":"%H",
10 "is_ipv6":%{if(req.is_ipv6, "true", "false")}V,
11 "is_tls":%{if(req.is_ssl, "true", "false")}V,
12 "is_h2":%{if(fastly_info.is_h2, "true", "false")}V,
13 "client_ip":"%h",
14 "geo_city":"%{client.geo.city.utf8}V",
15 "geo_country_code":"%{client.geo.country_code}V",
16 "server_datacenter":"%{server.datacenter}V",
17 "request_referer":"%{Referer}i",
18 "request_user_agent":"%{User-Agent}i",
19 "request_accept_content":"%{Accept}i",
20 "request_accept_language":"%{Accept-Language}i",
21 "request_accept_charset":"%{Accept-Charset}i",
22 "cache_status":"%{regsub(fastly_info.state, "^(HIT-(SYNTH)|(HITPASS|HIT|MISS|PASS|ERROR|PIPE)).*", "\\2\\3") }V",
23 "status":"%s",
24 "content_type":"%{Content-Type}o",
25 "req_header_size":%{req.header_bytes_read}V,
26 "req_body_size":%{req.body_bytes_read}V,
27 "resp_header_size":%{resp.header_bytes_written}V,
28 "resp_body_size":%{resp.body_bytes_written}V
29 }
30}
Was this guide helpful?

Do not use this form to send sensitive information. If you need assistance, contact support. This form is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.