简体   繁体   中英

How to find the log file INSIDE a Docker container?

I know how to find the container log outside of a container; what I'm trying to figure out is if there's an easy way to find the path to the container's log file inside of the container?

ie let's say the log file inside the container is at: /config/logs/blah.log

Is there a way to quickly find that path if I (the prompt) were sitting at, say, /home# ? (a command or something?)

Reason I ask is because it seems as if many container devs don't always put the log(s) in a standard place, and I often seem to have to go rooting through a bunch of directories trying to find it.

You can use "find".

find /etc -type f -name "*.log"

would output all.log files found inside /etc. You can adjust this query as you need. See the man page of find for more details.

Edit: Just saw your comment about being on alpine.

Install find with apk add findutils if installing useful additional components in your container is an option.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM