Simple CLI tool for retrieving logs from Cloudflare Logs Engine.
Before installing r2logs
, make sure Rust and Cargo are set up on your system. Install Rust and Cargo here.
Install r2logs
with:
$ cargo install r2logs --path .
Set up these variables before using r2logs
:
CLOUDFLARE_API_KEY
: Your Cloudflare API key.R2_ACCESS_KEY_ID
: Your R2 Access Key ID.R2_SECRET_ACCESS_KEY
: Your R2 Secret Access Key.CLOUDFLARE_ACCOUNT_ID
: Your Cloudflare Account ID.BUCKET_NAME
: Name of the bucket for log retrieval.
Retrieve logs within a specified time range using r2logs
. Time format: YYYY-MM-DDTHH:MM:SSZ
.
$ r2logs [OPTIONS] [START_TIME] [END_TIME]
$ r2logs # retrieve logs from 5 minutes ago to now
$ r2logs --help # print help
$ r2logs list # list relevant R2 objects containing logs
Specific time range, verbose output:
$ r2logs -v 2024-01-11T15:00:00Z 2024-01-11T15:01:00Z
Pretty print JSON output with jq and Fuzzy search logs with fzf
$ r2logs | jq . | fzf
List relevant R2 objects containing logs matching the provided query parameters:
$ r2logs list
$ r2logs 2024-01-11T15:00:00Z 2024-01-11T15:01:00Z list
Your contributions to r2logs
are highly appreciated! If you've got ideas for improvements or wish to contribute code, please feel free to open issues or submit PRs on our GitHub repository.