Finding size of log

Hi all. So I’m running one container. Want to see the size of the log before trancating to free up disk space.
But I can’t find what command I type in windows CMD/powershell to see the log size and space its taking up. I googled it and tried:

sudo du -h $(docker inspect --format=‘{{.LogPath}}’ $(docker ps -qa))

But get a message saying sudo is not a term recognised. So what do I type in CMD to see how much space the log has taken up so far?

Are you running Windows containers or Linux containers on Windows? If you don’t want to automate it, you could just run the inspect command and if it shows a Windows path, just go there in the file browser. If it is a Linux path, than you run Linux containers and everything is inside a virtual machine.

I’m running windows container on windows 11. Looking to know what command to type in CMD to see the the amount of space the log file has taken up so far.

What did the inspect command return? If it returned a valid Windows path then the question is just about Windows command line for which I would need to google probably as much as you

it gives the attached message.

sudo is a command that tells your machine to run what follows it using the Root user’s permissions
It seems not to be recognized, try to omit it and just run du -h ...

tried it. get the same message. du is not recognized…

Right, sorry, du is a Linux command, it won’t run on Windows, you’ll have to find an equivelant file-size reader

Edit: Misunderstood the command being ran, read rimelek’s answer

I mean’t only the docker inspect

docker inspect --format=‘{{.LogPath}}’ $(docker ps -qa)

Thanks. That seems to have worked. Its generated a json.log.

/var/lib/docker/containers/821dc714a1c0d3df2058db410147e6f405bc8f6a23d78e4efe0aa0b445198a83/821dc714a1c0d3df2048db410327e6f405bc8f6a23d78e4efe0aa0b675198a83-json.log

But doesn’t state the file size

Of course not.

It is a Linux path so you run Linu containers not Windows containers as you wrote before. If you are on Windows and run Docker Desktop, the container is in the virtual machine. It also means it is harder to truncate the logs and I’m not even sure you should as it could cause problems. You could just delete the container which deletes the logs as well and recreate the container. Since data should be on volumes or bind mounted, deleting the container should not cause data loss.