Skip to main content
The Log Traffic Policy action enables you to leverage ngrok’s eventing system to introduce observability into 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

Action type

log

Configuration fields

Behavior

Event logs

When this action is executed, the specified metadata will be collected 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 will log a message with the endpoint identifier for every request.

Example Traffic Policy document

Example request

Once the request has completed, and you have properly configured an event destination, you should see an event appear 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.