log
Records metadata about a request or connection, shown with that request in the Traffic Inspector.
| Phases | on_tcp_connecton_http_requeston_http_response |
| Terminating | No — the next action runs after it. |
| Cost | Free |
Example
policy.yaml
on_http_request:
- name: Audit
actions:
- type: log
config:
metadata:
message: Log action executed.
endpoint: "${endpoint.url}"
user: "${getReqHeader('x-user-id')}"
Start an agent endpoint with it: devgate http 8080 --traffic-policy-file policy.yaml, or paste it into a
reserved or cloud endpoint’s Traffic Policy tab in the dashboard.
Configuration
| Field | Type | Description |
|---|---|---|
metadata required | map | Up to 50 names and values to record. Values may be strings with ${…}, numbers, booleans, or nested maps and lists; a value that is exactly one ${…} keeps its type. |
Result variables
After it runs, later rules can read what it decided:
-
actions.ngrok.log.metadata— What the last log action recorded.
Behaviour
- Open the request in the Traffic Inspector to see its Traffic Policy logs: the phase, the rule’s name and the metadata. A scroll icon marks such requests in the list.
- Logs are kept with the request whether or not full capture is on.
- In on_tcp_connect the entry goes on the TCP or TLS connection; on an HTTP endpoint, on the request.
- Up to 16 KB of logs are kept per request; past that, later entries are dropped and a note says how many.
- ngrok sends these entries to event destinations. Exporting devgate’s logs to your own destination comes later; until then the Traffic Inspector is where they show up.
Other actions
add-headers remove-headers compress-response basic-auth oauth openid-connect jwt-validation custom-response deny redirect url-rewrite restrict-ips rate-limit circuit-breaker verify-webhook http-request set-vars close-connection forward-internal