logger
此内容尚不支持你的语言。
The logger plugin writes request and response activity to the process log (console).
Overview
Section titled “Overview”- Phase: Access, Log
- Purpose: Log request/response information to console
- Behavior: Outputs structured or text logs
Configuration
Section titled “Configuration”{ "pluginName": "logger", "config": { "level": "info", "format": "json" }}| Option | Type | Default | Description |
|---|---|---|---|
level | string | info | Log level: debug, info, warn, error |
format | string | json | Output format: json, text |
Log Levels
Section titled “Log Levels”Output Formats
Section titled “Output Formats”Usage Example
Section titled “Usage Example”Log Fields
Section titled “Log Fields”Request Phase (debug level)
Section titled “Request Phase (debug level)”| Field | Description |
|---|---|
type | ”request” |
request_id | Unique request ID |
method | HTTP method |
url | Request URL |
headers | All request headers |
route_id | Matched route ID |
service_id | Matched service ID |
target | Selected backend target |
timestamp | Log timestamp |
Response Phase
Section titled “Response Phase”| Field | Description |
|---|---|
type | ”response” |
request_id | Unique request ID |
method | HTTP method |
url | Request URL |
upstream_url | Backend URL |
status | Response status code |
duration_ms | Request duration (ms) |
timestamp | Log timestamp |
Integrating with Log Systems
Section titled “Integrating with Log Systems”JSON format integrates well with:
- Log aggregators (ELK, Loki)
- Cloud logging services
- Monitoring dashboards
See Also
Section titled “See Also”- file-log - Persistent file-based logging
- rate-limit - Rate limiting logs