Table: cloudflare_r2_object - Query Cloudflare R2 Objects using SQL
Cloudflare R2 is a storage service that provides fast, reliable, and cost-effective object storage. It is designed to handle data from any source, making it a versatile solution for storing, retrieving, and managing data. With R2, users can store any amount of data and access it anywhere at any time.
Table Usage Guide
The cloudflare_r2_object
table provides insights into the R2 Objects within Cloudflare. As a DevOps engineer, explore object-specific details through this table, such as the object ID, object type, and object content. Utilize it to manage and monitor your Cloudflare R2 Objects, ensuring optimal data storage and retrieval.
Important Notes
- Using this table adds to cost to your monthly bill from Cloudflare. Optimizations have been put in place to minimize the impact as much as possible. Please refer to Cloudflare R2 Pricing to understand the cost implications.
Examples
Basic info
Explore the specific details of an account's stored objects within a particular Cloudflare bucket to understand their size and changes. This can be useful for assessing storage usage and tracking modifications to objects within a specific time period.
select key, etag, sizefrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01';
select key, etag, sizefrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01';
List all objects with a fixed prefix
Discover the segments that have a specific prefix within your Cloudflare account. This is beneficial for organizing and locating specific sets of data, such as logs from a certain date.
select key, etag, size, prefixfrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and prefix = '/logs/2021/03/01/12';
select key, etag, size, prefixfrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and prefix = '/logs/2021/03/01/12';
List all objects with a fixed key
Discover the segments that contain specific objects within a given account and bucket, which can be useful for pinpointing where certain data is stored or identifying patterns in data storage.
select key, etag, size, prefixfrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
select key, etag, size, prefixfrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
List all objects which were not modified in the last 3 months
Explore the objects within a specific account and bucket that have remained unmodified over the past three months. This query can be used to identify stagnant or unused data, aiding in efficient data management and potential cleanup efforts.
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and prefix = 'static_assets' and last_modified < current_date - interval '3 months';
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and prefix = 'static_assets' and last_modified < date('now', '-3 months');
List objects created in the last 30 days
Explore objects that have been created in the past month within a specific account and bucket. This can be useful for monitoring recent activity or changes in your Cloudflare data.
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere creation_date >= now() - interval '30' day and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere creation_date >= datetime('now', '-30 day') and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
List objects that return truncated results
Determine the instances where certain objects are yielding incomplete results within a specific Cloudflare account and bucket, allowing you to identify and address potential issues with data integrity or retrieval.
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere is_truncated and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere is_truncated and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
List objects that have bucket key enabled
Explore which objects within a specific Cloudflare account have the bucket key enabled. This is particularly useful for identifying potential security risks or for auditing purposes.
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere bucket_key_enabled and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
select key, bucket, last_modified, etag, sizefrom cloudflare_r2_objectwhere bucket_key_enabled = 1 and account_id = 'fb1696f453testaccount39e734f5f96e9' and bucket = 'cloudflare_logs_2021_03_01' and key = '/logs/2021/03/01/12/05/32.log';
Schema for cloudflare_r2_object
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | = | ID of the account. |
bucket | text | = | The name of the container bucket of the object. |
bucket_key_enabled | boolean | Indicates whether the object uses an R2 Bucket Key for server-side encryption with Amazon Web Services KMS (SSE-KMS). | |
content_encoding | text | Specifies what content encodings have been applied to the object. | |
content_length | bigint | Size of the body in bytes. | |
content_type | text | A standard MIME type describing the format of the object data. | |
delete_marker | boolean | Specifies whether the object retrieved was (true) or was not (false) a delete marker. | |
etag | text | A a hash of the object. | |
key | text | = | The name assigned to an object. |
last_modified | timestamp with time zone | Specifies the time when the object is last modified. | |
metadata | jsonb | A map of metadata to store with the object in R2. | |
owner | jsonb | The owner of the object | |
prefix | text | = | The prefix of the key of the object. |
restore | text | Provides information about object restoration action and expiration time of the restored object copy. | |
server_side_encryption | text | The server-side encryption algorithm used when storing this object in Cloudflare R2. | |
size | bigint | Size in bytes of the object | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
storage_class | text | Provides storage class information of the object. | |
title | text | Title of the resource. | |
user_id | text | =, !=, ~~, ~~*, !~~, !~~* | ID of the current user. |
version | text | Version of the object. | |
website_redirection_location | text | If the bucket is configured as a website, redirects requests for this object to another object in the same bucket or to an external URL. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- cloudflare
You can pass the configuration to the command with the --config
argument:
steampipe_export_cloudflare --config '<your_config>' cloudflare_r2_object