reqlog/README.md
2023-02-28 19:06:26 -05:00

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

  1. Install Docker: sudo apt install docker.io
  2. Create an empty log file: touch requests.log
  3. 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
  1. 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.