skills/a6-plugin-http-logger/SKILL.md
Skill for configuring the Apache APISIX http-logger plugin via the a6 CLI. Covers pushing access logs to HTTP/HTTPS endpoints in batches, custom log formats with NGINX variables, conditional request/response body logging, batch processing tuning, and integration with external logging systems.
npx skillsauth add moonming/a6 a6-plugin-http-loggerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The http-logger plugin pushes request/response logs as JSON to HTTP or
HTTPS endpoints. Logs are batched for efficiency and support custom formats
using NGINX variables. Use it to send structured logs to any HTTP-based
logging backend (Elasticsearch, Loki, custom APIs, etc.).
| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| uri | string | Yes | — | HTTP/HTTPS endpoint for log delivery |
| auth_header | string | No | — | Authorization header value |
| timeout | integer | No | 3 | Connection timeout in seconds |
| log_format | object | No | — | Custom log format (supports $variable syntax) |
| include_req_body | boolean | No | false | Include request body in logs |
| include_req_body_expr | array | No | — | Conditional expression for request body logging |
| include_resp_body | boolean | No | false | Include response body in logs |
| include_resp_body_expr | array | No | — | Conditional expression for response body logging |
| concat_method | string | No | "json" | Batch format: json (array) or new_line (newline-separated) |
| ssl_verify | boolean | No | false | Verify SSL certificate for HTTPS endpoints |
| Field | Type | Default | Description |
|-------|------|---------|-------------|
| batch_max_size | integer | 1000 | Max entries per batch |
| inactive_timeout | integer | 5 | Seconds before flushing incomplete batch |
| buffer_duration | integer | 60 | Max age of oldest entry before forced flush |
| max_retry_count | integer | 0 | Retry attempts on failure |
| retry_delay | integer | 1 | Seconds between retries |
When no custom log_format is set, each log entry contains:
{
"client_ip": "127.0.0.1",
"route_id": "1",
"service_id": "",
"start_time": 1703907485819,
"latency": 101.9,
"apisix_latency": 100.9,
"upstream_latency": 1,
"upstream": "127.0.0.1:8080",
"request": {
"method": "GET",
"uri": "/api/users",
"url": "http://127.0.0.1:9080/api/users",
"size": 194,
"headers": { "host": "...", "user-agent": "..." },
"querystring": {}
},
"response": {
"status": 200,
"size": 123,
"headers": { "content-type": "...", "content-length": "..." }
},
"server": {
"hostname": "gateway-1",
"version": "3.15.0"
}
}
a6 route create -f - <<'EOF'
{
"id": "logged-api",
"uri": "/api/*",
"plugins": {
"http-logger": {
"uri": "http://log-collector:8080/logs",
"batch_max_size": 100,
"inactive_timeout": 10
}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"backend:8080": 1
}
}
}
EOF
curl http://127.0.0.1:9080/api/hello
# Check your log collector for the entry
{
"plugins": {
"http-logger": {
"uri": "http://log-collector:8080/logs",
"log_format": {
"@timestamp": "$time_iso8601",
"client_ip": "$remote_addr",
"host": "$host",
"method": "$request_method",
"uri": "$request_uri",
"status": "$status",
"latency": "$request_time",
"upstream_addr": "$upstream_addr"
}
}
}
}
{
"plugins": {
"http-logger": {
"uri": "https://log-service.example.com/api/v1/logs",
"auth_header": "Bearer eyJhbGciOiJIUzI1NiIs...",
"ssl_verify": true,
"timeout": 5
}
}
}
Log request bodies only when a query parameter is present:
{
"plugins": {
"http-logger": {
"uri": "http://log-collector:8080/logs",
"include_req_body": true,
"include_req_body_expr": [
["arg_debug", "==", "true"]
]
}
}
}
{
"plugins": {
"http-logger": {
"uri": "http://elasticsearch:9200/_bulk",
"concat_method": "new_line"
}
}
}
{
"plugins": {
"http-logger": {
"uri": "http://log-collector:8080/logs",
"batch_max_size": 5000,
"inactive_timeout": 30,
"buffer_duration": 120,
"max_retry_count": 3,
"retry_delay": 2
}
}
}
version: "1"
routes:
- id: logged-api
uri: /api/*
plugins:
http-logger:
uri: http://log-collector:8080/logs
batch_max_size: 200
inactive_timeout: 10
log_format:
timestamp: "$time_iso8601"
client_ip: "$remote_addr"
method: "$request_method"
uri: "$request_uri"
status: "$status"
upstream_id: my-upstream
| Symptom | Cause | Fix |
|---------|-------|-----|
| No logs arriving | Wrong uri or endpoint down | Verify endpoint is reachable from APISIX |
| SSL handshake failure | Certificate not trusted | Set ssl_verify: false for self-signed certs |
| Logs delayed | Large inactive_timeout | Lower inactive_timeout for faster delivery |
| Logs dropped | Buffer overflow | Increase batch_max_size; reduce delivery latency |
| Missing request body | include_req_body: false | Set to true (caution: memory impact) |
| Auth rejected | Wrong auth_header value | Include full header value (e.g. Bearer <token>) |
tools
Core skill for working with the a6 CLI — the Apache APISIX command-line tool. Provides project conventions, command patterns, architecture overview, and development workflow. Load this skill when working on a6 source code, adding new commands, writing tests, or modifying any a6 component.
tools
Recipe skill for implementing multi-tenant API gateway patterns using the a6 CLI. Covers tenant isolation via Consumer Groups, host/path/header-based routing, per-tenant rate limiting, context forwarding with proxy-rewrite, and declarative config sync workflows for multi-tenant management.
tools
Recipe skill for configuring mutual TLS (mTLS) using the a6 CLI. Covers SSL certificate management, upstream mTLS to backend services, client certificate verification, and end-to-end mTLS setup from client through APISIX to upstream.
tools
Recipe skill for configuring upstream health checks using the a6 CLI. Covers active health checks (HTTP probing), passive health checks (response analysis), combining both, configuring healthy/unhealthy thresholds, and monitoring upstream node status.