Linux – Monitor multiple Linux log files in real time

linuxloggingmonitoringrealtimetail

I'm debugging a Linux application that allows remote jobs to be submitted, logging the output from each job in a new file. The log file paths conform to:

/joblogs/job_*/JOB.LOG

where the wild card represents the unique job number.

I want to be able to tail each job log, including new logs that are created after I issue the tail (or whatever) command. I thought I'd be able to do this using multitail, but I can't figure out the right set of parameters to use. For example,

multitail -q 1 "/joblogs/job_*/JOB.LOG"

seems to create a window for each new log file just the way I want, but it doesn't show any output in the file window.

Anyone know how to do this, either with multitail or another Linux tool ?

Best Answer

Since there is only one job active at a time, completed job logs are moved to /joblogs/completed_jobs/job_* and the logs are short, this hokey workaround is OK for now:

while [ 1 == 1 ] ; do for joblog in `ls /joblogs/job_*/JOB.LOG`; do cat $joblog; done; sleep 10; done