Fastly Object Storage as a logging destination

You can set up Fastly Object Storage as a destination for your services’ real-time logs. Because it’s S3-compatible, we can use the S3 logging endpoint with minimal configuration.

First, you’ll need to sign up for Fastly Object Storage. In the Fastly web UI, visit Resources → Object Storage, or visit this page.

Then you’ll need to generate credentials for the integration. On the Object Storage page, click the “+ Create Key” button. Give it any description you want, and choose the “Read and write” scope. Click the “Create” button and make note of the Access key ID and Secret access key. This the only time you will be able to see the secret key. You will use these in your logging configuration.

You’ll need to create a bucket to hold your data. There are various tools to do this, including the AWS CLI. This post shows you how to configure the AWS CLI and create a bucket.

In your service’s configuration, go to the Logging section and click “Create endpoint.” Then choose “Amazon S3.” Customize the endpoint however you like, but you’ll need to set a few fields specifically for Fastly Object Storage:

  • Bucket name - The name of the bucket you created above
  • Domain - This is the region-specific hostname where you created your bucket. Either us-east.object.fastlystorage.app, us-west.object.fastlystorage.app, or eu-central.object.fastlystorage.app.
  • Access method - “User credentials”
  • Access key - The access key from the Fastly web UI
  • Secret key - The secret key from the Fastly web UI

And that’s it! You don’t need to touch the “Advanced options” but if you do, make sure you leave “Redundancy level” at “Standard”, “ACL” at “None”, and “Server side encryption” at “None”. When you’re ready, activate your new service version and logs will be written to your bucket.

Unless you’ve shortened the Period setting (which defaults to 3600 seconds, or one hour) you may need to wait up to an hour for the logs files to start appearing.

3 Likes