830 B
830 B
Request Logger
Serves an HTTP server on port 8080 and logs any requests to a file, stdout, and the response body.
This is not intended for production use. It is just a simple diagnostic tool for short-term testing.
General use
- Install Docker:
sudo apt install docker.io
- Create an empty log file:
touch requests.log
- Run a container:
docker run \
--name reqlog \
--restart always \
-d \
-p 8080:8080 \
-v $(pwd)/requests.log:/requests.log \
git.roeber.dev/jon/reqlog:v0.0.2
- Test:
curl \
-X POST \
http://localhost:8080/ \
-H "Content-Type: application/json" \
-d '{"temp": 98.6}'
The request gets logged to requests.log
, printed to stdout (if running a container in daemon mode, check stdout with docker logs reqlog
), and returned in the response body.