What is the best way to find a specific string in the logs of a docker container? Let's say I want to see all requests, that are made in the "nginx" docker image that came from a ip starting with "127."
grep wont work as expected on docker logs command:
docker logs nginx | grep "127."
It prints all logs, but does not filter the result!
this can happen if the container is logging to stderr, piping works only for stdout, so try:
docker logs nginx 2>&1 | grep "127."