Skip to main content
The Log Traffic Policy action enables you to use ngrok’s eventing system to add observability to your Traffic Policy documents.

Configuration reference

The Traffic Policy configuration reference for this action.

Supported phases

  • on_tcp_connect
  • on_http_request
  • on_http_response

Type

log

Configuration fields

Behavior

Event logs

When this action runs, ngrok collects the specified metadata on the tcp_connection_closed.v0 event under the traffic_policy.logs key.

Non-terminating action

This is a Non-terminating action. It does not return a response, and will allow Traffic Policy processing to continue to the next Action in the chain. All Cloud Endpoint Traffic Policies must end with a terminating action. This requirement does not apply to Agent Endpoints.

Examples

Logging with CEL interpolation

The following Traffic Policy configuration logs a message with the endpoint identifier for every request.

Example Traffic Policy document

Example request

After the request completes, and if you’ve configured an event destination, an event appears with the following payload:

Action result variables

The following variables are made available for use in subsequent expressions and CEL interpolations after the action has run. Variable values will only apply to the last action execution, results are not concatenated.