One file, one Stream…
Ever since the very first version, a Stream in LogRaker has followed exactly one log file. On the boat that was never much of a problem, since each device only has a handful of logs I actually care about, so I added them once and that was that (well, the Jetson pushed it a bit).
But most servers aren’t like my boat. A web server easily has a dozen log files in /var/log alone, nginx keeps an access log and an error log for every site, and some apps start a new log file every day, or write one per worker… and every single one of those meant YET ANOTHER Stream to add by hand. Worse, the log file the app started this morning wasn’t in LogRaker at all until I noticed it and added that one too.
So LogRaker 3.2 has Folder Streams. You point one Stream at a folder, and it follows every log file in there. Subfolders too, if you want. With file patterns. The works!
Setting one up
Select a Source (your Mac or an SSH server), choose + ▸ ‘New Stream…’ and set the Source type to Folder. Then pick the folder, on your Mac with the usual folder picker, and on an SSH Source you can type the path or click the folder button to browse the server’s folders right from the editor. While you browse, the files that match read normally and the rest are dimmed, so you see right away what you’d get.
Files says which files to follow, as patterns like *.log or *.trace, and * follows every file. By default it only follows files that changed in the last 7 days, so last year’s leftovers stay out of the way, and if your logs are spread out a bit more, ‘Include subfolders’ goes up to three levels down. Before you save, ‘Test’ tells you how many files it would follow, and ‘Show Files’ lists them, so there are no surprises later.
Everything in one timeline
This is the part I like most. All the lines from all those files show up in one table, sorted by time. So when something went wrong at 14:32, I can step through what nginx and the app wrote around then, in the order it actually happened, without building a Merge Streams Layout first. And since all those files live on the same machine, they share one clock, so there’s no clock skew to worry about either.
The File column says which file each line came from (like nginx/access.log), and Filter and Find match the file name too, so typing nginx/ in Filter shows only nginx’s lines. Click the File column’s header and the lines sort by file instead.
When the Stream starts, every file gets its share of the history, so a busy log doesn’t hide the quiet ones.
… or just the one file
Of course, sometimes I do want to look at a single file. Once a Folder Stream runs, its row in the sidebar gets a disclosure triangle, with one row per file under it. Select one and you see only that file’s lines, and Filter, Find, Pause and the line inspector work just like they do on the whole Folder. Right-click a file’s row for ‘Open in New Window’, ‘Copy Path’, or on your Mac ‘Show in Finder’.
It keeps up with the folder
New files show up on their own within a few seconds, with up to 1,000 of their latest lines, and files that go away drop off the list again. When logrotate does its thing, LogRaker simply follows the new file under the same name.
If you want the history from before the last rotation too, check ‘Include rotated and compressed files’ and it also reads the older copies like app.log.1 or app.log.2.gz, and unpacks the compressed ones (.gz and .xz on your Mac, and over SSH also .bz2 and .zst where the server has the tool for it). Files that aren’t text, like the binary login records in /var/log, are left out, and the Stream tells you which ones it skipped.
Over SSH, all of it runs over one single connection no matter how many files there are, and the server only needs sh, find, tail and awk, which pretty much every Linux box and Mac already has.
A phone that’s hours off
The same reader on Product Hunt whose question about clocks led to When Two Clocks Disagree brought up a use case I hadn’t even thought of. They had a bunch of log files from a phone whose clock ran nine hours ahead of the backend server, and wanted to line them up with the server’s logs.
With Folder Streams that’s now pretty easy. Throw the phone’s log files into a folder on your Mac, add a Local System Source just for them (you can have more than one, and that way the time correction only moves the phone’s logs), and point a Folder Stream at that folder. If the files are older than a week, set Changed to ‘Any Time’, and if they’re long, turn up ‘Initial history’ in Settings ▸ Streams so more of them gets read in.
Then put the phone’s Folder Stream and the server’s Stream into a Layout. Right-click a line in the server’s log and pick ‘Set Ref Time’, find the same event in the phone’s logs, right-click it and pick ‘Align to Ref Time’, and every one of the phone’s files shifts by the same offset at once. From there, ‘Sync to selected Time’ lines up both panes on any moment you pick (there’s more on that in When Two Clocks Disagree).
Still just a Stream
A Folder Stream is an ordinary Stream otherwise, so it goes into a Layout pane next to your other Streams, and when a Monitor watches it, every file in the folder counts.
So, if you’ve got servers with folders full of log files, give LogRaker 3.2 a try. One Stream is all it takes now, and honestly I wish I’d built this sooner! All the details are in the Folder Streams docs.
Thanks for reading!