A lightweight HTTP server that logs HTTP requests containing JSON payloads, with optional header logging and environment-based metadata.
This application captures incoming HTTP POST requests and logs the JSON body, request path, optional headers, and environment variable metadata. It is useful for debugging, testing, and local development when you want to inspect JSON payloads and related request context.
Why use this? This tool provides a simple way to log JSON requests for debugging, testing, and inspection. It allows for opt-in logging of request headers and provides a mechanism to inject metadata from environment variables.
Should I run this in production? No. This could expose sensitive information from headers and payloads. It is intended strictly for debugging, development, and testing.
The latest gologhttpjson Docker image is available for deployment from GitHub Packages at gologhttpjson on GitHub Packages.
You can deploy this application locally with Docker:
docker run -p 8080:8080 ghcr.io/unitvectory-labs/gologhttpjson:latestAll responses return an HTTP 200 status code with a body of OK. This application is designed to log request payloads for inspection.
The log output is structured as JSON with the following attributes:
body– the original JSON payloadpath– the HTTP request pathheaders– optional, logged ifLOG_HEADERSis setmetadata– optional, populated from environment variables prefixed withMETADATA_
Example (pretty-printed for readability):
{
"body": {
"event": "user.created",
"data": {"id": 123}
},
"headers": {
"Authorization": "Bearer token123",
"Content-Type": "application/json",
"User-Agent": "curl/7.68.0"
},
"metadata": {
"SERVICE": "api",
"VERSION": "1.0"
},
"path": "/api/webhook"
}This application runs as a Docker container or via Go directly. It supports the following environment variables:
PORT– the port the application listens on (default8080)LOG_HEADERS– set to any non-empty value to enable logging of HTTP headersMETADATA_*– any environment variable prefixed withMETADATA_will be logged under themetadatafield