{"repo":"pew/cloudflare-worker-logpush-loki","free":true,"listed":false,"github":"https://github.com/pew/cloudflare-worker-logpush-loki","clone":"git clone https://github.com/pew/cloudflare-worker-logpush-loki.git","description":"Send Cloudflare Logpush Logs to Grafana Loki","language":"JavaScript","stars":32,"topics":["cloudflare","cloudflare-workers","grafana","loki"],"license":"MIT","category":"analytics","readme_excerpt":"Logpush to Grafana Loki Endpoint - Logpush to Grafana Loki Endpoint - Create the Worker - Logpush - Get Log Fields - Create Logpush Job - Debugging - Todo / Improvements You can configure Cloudflare Logpush to send Logs to any HTTP destination, so let's send some logs to Grafana Loki. This Worker takes the incoming Logpush JSON Format and transforms it into something Loki understands: - take incoming gzipped Logpush data, unpack it - merge all fields into the Loki API format and send it off to the destination - profit Create the Worker - clone this repo - update wrangler.jsonc to point to your Grafana Loki HTTP Endpoint - feel free to make other adjustments in wrangler.jsonc to your liking - deploy the worker: Note down the returned URL to create the actual logpush job. Logpush - You can configure Cloudflare Logpush through the Dashboard or API. Get Log Fields First, get all the available log fields for your zone. To do this, get your Zone ID from the Cloudflare Dashboard and generate an API Key. Replace and your-token-here in the following command: You should see a comma separated list of available fields you can send to your destination Create Logpush Job Here's a curl request to create a Logpush Job with a lot of included fields already. You might want to update the fields= field below with the output from above. Please keep the &timestamps=unixnano : - please make sure to update the following fields in the curl request above: - your own zone id instead of - your own API K","default_branch":null,"files":null,"tree":[],"storefront":"/r/pew","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/pew/cloudflare-worker-logpush-loki/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}