turbot/cloudflare
steampipe plugin install cloudflare

Table: cloudflare_worker_route - Query Cloudflare Worker Routes using SQL

Cloudflare Worker Routes is a feature within Cloudflare that allows you to specify paths on your website where Cloudflare Workers scripts should be triggered. It provides a flexible way to control the behavior of your website by allowing you to run serverless code at the edge of Cloudflare's network, close to your users. Cloudflare Worker Routes helps you improve the performance and security of your web applications by executing scripts for specific routes.

Table Usage Guide

The cloudflare_worker_route table provides insights into Worker Routes within Cloudflare. As a DevOps engineer, explore route-specific details through this table, including the paths where scripts are triggered and the corresponding script ID. Utilize it to uncover information about routes, such as those with specific scripts, the distribution of scripts across different routes, and the optimization of script execution.

Examples

Basic info

Explore which Cloudflare worker routes are currently in place. This can help identify potential areas for optimization or troubleshooting.

select
id,
zone_name,
pattern,
script
from
cloudflare_worker_route;
select
id,
zone_name,
pattern,
script
from
cloudflare_worker_route;

List idle worker routes (i.e. not attached to any worker)

Discover the segments that consist of idle worker routes that are not attached to any worker. This is beneficial for identifying unused resources and optimizing your Cloudflare configuration.

select
id,
zone_name,
pattern
from
cloudflare.cloudflare_worker_route
where
script = '';
select
id,
zone_name,
pattern
from
cloudflare_worker_route
where
script = '';

Schema for cloudflare_worker_route

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
idtextAPI item identifier tag.
patterntextPatterns decide what (if any) script is matched based on the URL of that request.
scripttextName of the script to apply when the route is matched. The route is skipped when this is blank/missing.
zone_idtext=Specifies the zone identifier.
zone_nametextSpecifies the zone name.

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_worker_route