/plushcap/analysis/cloudflare/logs-from-the-edge

Logs from the Edge

What's this blog post about?

Cloudflare Workers, a JavaScript environment at the edge, can be used to send traffic logs to arbitrary locations. This post discusses an example implementation of how to achieve this using sub requests. The provided script assumes an Elastic stack setup and sends log data asynchronously to avoid adding latency to the main request. The logToElk function collects various fields from the HTTP request, including some specific to Cloudflare, and then uses a sub request to PUT the log line to the backend ELK stack. This method allows users to import Cloudflare traffic logs into their ELK stack in real time regardless of their plan. Additionally, Argo Tunnel and Access can be used to improve Kibana deployment security.

Company
Cloudflare

Date published
Nov. 29, 2018

Author(s)
Michael Tremante

Word count
976

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.