Very often during the software development I face the situation I need to log sent request fro my applications such as logs, metrics and so on. These request are in production directed to ELK stack, Prometheus, influxDB or to another 3rd party service. But for local development I don’t want to run these services on my machine because of the resources consumption. I just want to verify if my app sent the data in proper format.
So I started using netcat for catching e.g. UDP request received on localhost:4444 by running `nc -i1 -uklv 4444`. Created dockerfile and published it to docker hub as kedlas/udplogger, if you’re interested in using it via docker or using it in your docker-compose projects.
Then I needed to log the HTTP requests too and I was too lazy finding the proper netcat command parameters on google so I decided to write my own UDP/HTTP/… request logger in Go to practice myself in this language. And… here it is kedlas/goreqbin.
Goreqbin is simple Go app that starts UDP and HTTP servers and logs all received requests. New servers and log methods may be easily added. Right now the output logging is to stdout only. It is good enough for me for development usage, but you are very welcome to contribute and and new output methods and/or new servers.
The output on stdout may look like this:
Usage is very simple and you may run the app locally via
go run or you can use docker image that is called
kedlas/goreqbin:latest and you can find it on docker hub too.
In my current project I got used to run this one small container instead of ELK, InfluxDB, Prometheus etc. and redirect all my apps metrics to this container ports. Now I have all the data in one place. Give it a try, tell me if you like or dislike it. Every feedback is welcome.