INTEGRITY Cloudflare Docs

Tail Handler

Background

The tail() handler is the handler you implement when writing a Tail Worker. Tail Workers can be used to process logs in real-time and send them to a logging or analytics service.

The tail() handler is called once each time the connected producer Worker is invoked.

To configure a Tail Worker, refer to Tail Workers documentation.

Syntax

export default {
  async tail(events, env, ctx) {
    fetch("<YOUR_ENDPOINT>", {
      method: "POST",
      body: JSON.stringify(events),
    })
  }
}
from workers import WorkerEntrypoint, fetch
import json

class Default(WorkerEntrypoint):
    async def tail(self, events, env, ctx):
        await fetch("<YOUR_ENDPOINT>", method="POST", body=json.dumps(events))

Parameters

Properties

TailItems

Properties

FetchEventInfo

Properties

TailRequest

Properties

Methods

Some of the properties of TailRequest are redacted by default to make it harder to accidentally record sensitive information, like user credentials or API tokens. The redactions use heuristic rules, so they are subject to false positives and negatives. Clients can call getUnredacted() to bypass redaction, but they should always be careful about what information is retained, whether using the redaction or not.

TailResponse

Properties

TailLog

Records information sent to console functions.

Properties

TailException

Records an unhandled exception that occurred during the Worker invocation.

Properties