问题
I am trying to use tail utility in linux to monitor the logs present under nested directories.
I tried using tail -f /var/log/**/*
but this only go till direct child of log
directory. It does not dig beyond one level.
Basically I am trying to tail all the application logs in docker container and pass them to /proc/1/fd/1, so that they appear under docker logs.
回答1:
You need to enable
shopt -s globstar
if it is disabled in your shell.
With this setting enabled, Bash will recurse directories with **
.
This is not a feature of Docker or tail
, it is a feature of your shell.
来源:https://stackoverflow.com/questions/58101405/how-to-use-tail-f-recursively-on-a-directory-and-its-sub-directories