5

I'm trying to get multitail (6.0) on Ubuntu to tail -f any log files (even new ones) in certain directories recursively by doing:

multitail -Q 1 /home/default/storage/accounts/**/*.log

This just produces a blank screen.

So I tried being more specific with the dir to monitor:

multitail -Q 1 /home/default/storage/accounts/1/entries/1/logs/imports/*.log

But I get the same blank screen even if the log files change.

What am I doing wrong here?

eComEvo
  • 1,041

2 Answers2

3

For what you're trying to accomplish, you'll want to use the -Iw parameter instead of -Q. This tells multitail to tail existing files (all in one window), as well as watching for new files and tailing them (also in the same window). The "1" following the wildcard pattern specifies to watch for new files every second. You also need to add quotes around the paths to prevent the shell from expanding them, so you finally get to:

multitail -Iw "/home/default/storage/accounts/**/*.log" 1
hampercm
  • 199
  • I tried this with quotes, but all I see is an empty window with a highlighted bar at the bottom containing 00] /home/default/storage/accounts/1/entries/1/logs/imports/imports.items-20160811.log *Press F1/<CTRL>+<h> for help*. If anything is written to that log file, it is never displayed in the multitail window. – eComEvo Aug 11 '16 at 21:33
  • If I were to do multitail -Q 1 "/home/default/storage/accounts/**/*.log" that syntax doesn't even show the highlighted bar at the bottom...just a blank screen containing --*- multitail 6.0 (C) 2003-2013 by folkert@vanheusden.com -*--. Is that syntax even possible? – eComEvo Aug 11 '16 at 21:38
  • I realized my first post wasn't actually doing the task you were asking about: -Q only watches for new files, it does nothing with existing ones. I've updated my answer to something that will work for you. – hampercm Aug 12 '16 at 13:17
  • 1
    Unfortunately it still doesn't work. Screen stays blank no matter if I add something to a log or create a new log file. Using tailf works, but it doesn't catch new logs like I hoped multitail would. – eComEvo Aug 12 '16 at 15:56
  • You should at least be seeing the tails of existing files when you run the above command, which suggests perhaps multitail isn't able to read any files matching the wildcard pattern you specified. Have you verified that the pattern is correct, and the files are readable? – hampercm Aug 12 '16 at 18:01
  • You could also try the second pattern you gave in the OP, or even specify one specific file's path in the quotes to see if any of those produce some visible output. – hampercm Aug 12 '16 at 18:04
  • 1
    Hi @eComEvo I know this question was asked in 2016, and I see, you did not get any answer to it. Today, I am also facing same issue, basically with new log files after multitail process has started. Were you able to get a solid answer to your question? If yes, could you please let me know.! Btw below is my question link https://stackoverflow.com/questions/62350240/monitor-entire-directory-recursively-for-tailing-logs-using-multitail – Nish Jun 13 '20 at 19:42
  • @Nish I think I got it solved, though I am three years late! :-D – 00prometheus May 24 '23 at 19:03
  • @00prometheus thanks buddy. Better late than never! :D – Nish May 26 '23 at 08:24
0

I don't know if your ../**/.. syntax is valid, I couldn't find any documentation on it related to multitail. However, multitail -h says this about the -q option:

One can enter paths here understood by the shell. E.g. "/tmp/*".

So, it might depend on your shell? Using multitail under bash, as long as you have a fixed recursion depth, you can replace several directory names in the path, each with a single *. This method is tested and works:

multitail -Iw /home/default/storage/accounts/*/entries/*/logs/imports/*.log 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community May 28 '23 at 14:49
  • The reference is the 'multitail -h' command, though it seems the bot doesn't understand that there is a reference already :-D – 00prometheus May 28 '23 at 15:40