Is there an easy way to do something like tail -f mylogfile but to have the changes of more than one file displayed (maybe with the file name added as prefix to each line)? Or maybe a GUI tool? I am running Debian.
3 Answers
Have you tried tail -f file1 file2? It appears to do exactly what you want, at least on my FreeBSD machine. Perhaps the tail that comes with a Debian system can do it too?
-
2Yes. It works! Thank you. I'd never expected that it would be SO easy.stofl– stofl2012-12-04 11:37:25 +00:00Commented Dec 4, 2012 at 11:37
-
13I usually use
-Finstead since a number of files may get truncated as I'm restarting server programs.Arcege– Arcege2012-12-04 23:37:25 +00:00Commented Dec 4, 2012 at 23:37 -
16My new favorite parameter combo is
tail -qF *.log:-qto hide the file names and-F, as Arcege pointed out, to lettailfollow the name rather than the descriptor because my log files are being rotated.Dawn Drescher– Dawn Drescher2016-10-04 10:26:40 +00:00Commented Oct 4, 2016 at 10:26 -
Validated also on Ubuntu 16.04 LTSRicardo– Ricardo2017-05-12 02:03:54 +00:00Commented May 12, 2017 at 2:03
-
There is a limit to this. I have a folder with log files by PID for a worker that gets started for every new job in a queue (So lots of PIDs). If I
tail -f /var/log/folder/*it returns the error "unable to execute /usr/bin/tail: Argument list too long"flickerfly– flickerfly2018-05-18 16:20:07 +00:00Commented May 18, 2018 at 16:20
For some reason, answers along the lines of tail -f file1 file2 wasn't quite what I had in mind.
I want to know what happened in several logs sort of most recently 'locally', regardless of the global chronological order.
To do that, I used something more like watch -n1 tail -n10 file1 file2
For the exercise i wrote small node utility that does the same thing as tail -f f1 f2 f3
Splex:
https://www.npmjs.com/package/splex
The main "upgrade" is that lines are color coded per file name, and that you can have table-like interface.
Another improvemtn, actually main reason I wrote this, is the ability to have .splexrc.json files in different folders, so instead having to type tail -f f1 f2 f3in one folder, then different files in other, you can write .splexrc.json file in root of your project and just type splex without file list arguments and it automatically stream relevant logs you enumerated in config file.
multitailis the king there. See Combine input from multiple files/pipes without clobbering lines or blocking?