Send Logs Over HTTP
Purpose: ingest logs over HTTP and verify they are available for immediate retrieval/streaming.
Preconditions
- JsonLog service is reachable.
- For private channels, have a Bearer token with matching
acc. - Always send a JSON request body for
POST /log(minimum{}).
API/Script Flow
- Send public event:
POST /logwith JSON payload.
- Send channel event:
POST /log?cid=<channel_id>with JSON payload.
- Read buffered logs:
GET /logfor public logs.GET /log?cid=<channel_id>for channel logs.
HTTP/curl Flow
JSONLOG_BASE_URL="http://localhost:3002"
ACCESS_TOKEN="<optional_account_token>"
# Public event (no auth required)
curl -sS -X POST "${JSONLOG_BASE_URL}/log" \
-H "content-type: application/json" \
--data '{"message":"hello from public","service":"web"}'
# Channel event (auth optional unless channel is private)
curl -sS -X POST "${JSONLOG_BASE_URL}/log?cid=svc-api" \
-H "authorization: Bearer ${ACCESS_TOKEN}" \
-H "content-type: application/json" \
--data '{"message":"channel event","_jsonlog":{"lvl":"info"}}'
# Read public buffer
curl -sS "${JSONLOG_BASE_URL}/log"
# Read channel buffer
curl -sS "${JSONLOG_BASE_URL}/log?cid=svc-api" \
-H "authorization: Bearer ${ACCESS_TOKEN}"
Validation
POST /logreturns200on accepted payloads.GET /logreturns an array.GET /log?cid=<id>returns an array for visible channels,404for private channels with wrong account.