Skip to main content

Cloudflare Web Application Firewall downloader

Build Status PyPI version Python Versions License

A library, CLI, and docker image that downloads Cloudflare WAF logs for a specified zone_id and time frame.

Schema

See src/waf_logs/resources/db/ for a list of schemas that are auto-applied at start. This can be disabled by passing --ensure_schema False.

Quickstart

The project is published at https://pypi.org/project/waf-downloader/.

Install it via:

pip install waf-downloader

# or alternatively, directly from git
pip install "git+https://github.com/MihaiBojin/waf-downloader@main"

Or with Docker:

docker pull ghcr.io/mihaibojin/waf-downloader:latest

The list of published images can be found at: https://github.com/MihaiBojin/waf-downloader/pkgs/container/waf-downloader

Build and run with Docker

Define secrets in an .env file (do not quote values):

CLOUDFLARE_TOKEN=...
DB_CONN_STR=...

The Cloudflare token is required, but the connection string is optional. If skipped, it will result in logs being printed to stdout.

Build and run:

# Build
make docker

# Load all logs in zone, starting 5 minutes prior
make docker-run ARGS="--zone_id [CLOUDFLARE_ZONE_ID] --start_minutes_ago -5"

# And alternatively, only output the logs
make docker-run ARGS="--zone_id [CLOUDFLARE_ZONE_ID] --start_minutes_ago -5" 2>/dev/null

Publishing to PyPI

GitHub-based version publishing

The simplest way to publish a new version (if you have committer rights) is to tag a commit and push it to the repo:

# At a certain commit, ideally after merging a PR to main
git tag v0.1.x
git push origin v0.1.x

A GitHub Action will run, build the library and publish it to the PyPI repositories.

Manual publish

These steps can also be performed locally. For these commands to work, you will need to export two environment variables (or define them in .env):

export TESTPYPI_PASSWORD=... # token for https://test.pypi.org/legacy/
export PYPI_PASSWORD=... # token for https://upload.pypi.org/legacy/

First, publish to the test repo and inspect the package:

make publish-test

If correct, distribute the wheel to the PyPI index:

make publish

Verify the distributed code

make publish-verify

Cloudflare WAF documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waf_downloader-0.1.3.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waf_downloader-0.1.3-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file waf_downloader-0.1.3.tar.gz.

File metadata

  • Download URL: waf_downloader-0.1.3.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for waf_downloader-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ed468d564a02ba7e876d2513953c65711208ae9ee5731a55f15156a1c0a39f05
MD5 939c6c431742b829deec010ab28f971d
BLAKE2b-256 c417e3f35e76293e7699107ad029f4bc1625148f45fe29c3eccadd29c644cbf6

See more details on using hashes here.

File details

Details for the file waf_downloader-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: waf_downloader-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for waf_downloader-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 028028f8f7e79b7535d079a2a4cd731475551b0080316914d4dbd8ef326acf1d
MD5 ba71624ee5e48f2fd6103467a284ebcf
BLAKE2b-256 4250d5e4feeee3cc837044670e9961f641a79b849d06178e37f47a8b8f6c3064

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.24

2 files

0.2.23

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.22

2 files

0.1.20

2 files

0.1.19

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

This release

0.1.3 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page