Docker Community Forums

Share and learn in the Docker community.

Get log of clients that access the container

I am hosting a video file within a docker Container.
I want to get or record the log of clients ip and time of access to the video file or the container.
Is it possible to do? Can someone guide me.

How are you hosting it?
is: docker logs ContainerID enough?

Whatever your containerized process is should be able to be configured to write out access logs, including origin ip.

Keep in mind, however, that ingress connections going through swarm mode routing mesh will see the local services vip instead of the true origin.

1 Like

I am deploying them on baremetal and VMs using SWARM. In the second stage I will use Kubernetes. Initially I have created a single container on the machine and got the data of CPU, Memory and throughput usage via Prometheus query in the JSON format.
Now I want to get the data for number of users/cleints(I will run Bash script from another machine) that will access the container. I will use these statistics for quantitative comparison between swarm and kubernetes.
I am new to containers and Docker, If you have any suggestions on how to do it, it would be of great help to me.

First, thanks for your reply. So, the VMs participating in the SWARM will not be able to record the client ID, They will record the IP of the Swarm manager? The default log file present in the container keeps the log of incoming IP addresses and time. Can you guide or suggest come links for reading on how i access that file on physical drive?
Secondly, In my experiment I am deploying containers on both baremetal and VMs in a SWARM. I will generate parallel client requests through a bash script from another machine, I want to know which container responded to the specific request. Is there any way to do it?