Send all your Cloudflare Logpush logs to a Slack channel using a Cloudflare Worker and the HTTP destination feature.
(If you're using the Deploy button above, manually add the secret with the variable name SLACK_BOT_TOKEN through the dashboard.)
- Clone this repo
- Deploy the Worker
npm run deploy- Note down the returned URL to create the actual Logpush job
- Create a secret for your Slack bot token (requires
chat:writepermission for your bot)
npx wrangler secret put SLACK_BOT_TOKEN- Add the Worker endpoint as an HTTP destination in Cloudflare Logpush.
- Specify the Slack channel name as a query string parameter (without the
#), for example:
https://foobar.workers.dev/?channel=logs
This will send all incoming Logpush entries to the #logs channel in your Slack workspace.
- The Worker expects newline-delimited JSON log entries (the default for Logpush HTTP destinations).
- The Slack bot token must have permission to post to the specified channel.