simple cloudflare worker recipe to send logs into logdna
Clone or download
Pull request Compare This branch is 1 commit ahead, 6 commits behind boynet:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
index.js

README.md

cf-dnalog-worker

simple cloudflare worker recipe to send logs into logdna

how to use

copy index.js content into your worker change myApp and myHostName into whatever you want, read the logdna Ingest API

  • requestsPerBatch - how many requests to maximum batch per request
  • maxRequestsAge - how much time to maximum old requests in the memory before sending it

about compiledPass

you should precompile your logdna ingestion key and store it in the compilePass parameters, you can simply type in console btoa(username+':'+password) where username is your ingestion key and password keep empty, and put the results into the parameter to save some cpu time(probably)

I left all the console.log command to better help you debug

logged parameters:

  • user agent
  • referer
  • ip
  • countryCode
  • url
  • colo
  • workerInception
  • method
  • x_forwarded_for
  • asn