Log
Overview
The Log policy action allows you to leverage ngrok's eventing system to introduce observability into your traffic policy.
Example
Use this action config in your Traffic Policy
- YAML
- JSON
# snippet
---
actions:
- type: "log"
config:
metadata:
message: "Invalid TLS Version"
edge_id: "edghts_2bhsN2VP8W4pTkaMSrhyj0SRf8J"
edge_route_id: "edghtsrt_2bhsN5u05QQ1MRrI3XbpDQMFSE7"
// snippet
{
"actions": [
{
"type": "log",
"config": {
"metadata": {
"message": "Invalid TLS Version",
"edge_id": "edghts_2bhsN2VP8W4pTkaMSrhyj0SRf8J",
"edge_route_id": "edghtsrt_2bhsN5u05QQ1MRrI3XbpDQMFSE7"
}
}
}
]
}
Request:
curl https://example.ngrok.app/api/v1
Result:
Behavior
When this action is executed, the specified metadata will be collected on the http_request_complete.v0 event
under traffic_policy.logs
.
Reference
Supported Directions
- Inbound
- Outbound
Configuration
Type |
---|
log |
Parameter | Description | |
---|---|---|
metadata | Map<string, any> | A map of metadata that you would like to be included in the details of your log event. |