nuts3745 / r2logs

A simple CLI tool to retrieve logs from Cloudflare Logs Engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

r2logs

Simple CLI tool for retrieving logs from Cloudflare Logs Engine.

Installation πŸ› οΈ

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 .

Environment Variables 🌐

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.

Usage πŸ”

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

Examples πŸ“

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

Contributing πŸ‘

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.

References πŸ“š

About

A simple CLI tool to retrieve logs from Cloudflare Logs Engine.


Languages

Language:Rust 97.7%Language:Makefile 2.3%