clfmerge(1)
π clfmerge β the logtools girlie who merges your Common-Log Format web logs by time-stamp π
okay so bestie, pull up a chair because this one is genuinely one of my faves. clfmerge lives in the logtools manual (section 1, obvs) and it's about to make your giant web logs behave. β¨
πΈ SYNOPSIS πΈ
clfmerge [--help | -h] [-b size] [-d] [-v] [file names]
that's it. that's the whole vibe. π«Ά
π¦ DESCRIPTION π¦
so here's the tea: clfmerge exists so you literally never have to reach for sort to merge multiple web log files. never. π
picture this β big sites have web logs split across multiple files, all sitting in the >100M size range, coming off a whole bunch of machines. for files like that, using something like gnusort to merge them is just not it:
- the data isn't always entirely in order, so
gnusort's merge option doesn't work so well π - but it's also not in random order, so doing a complete sort would be a total waste π
- and the date field you'd be sorting on is not particularly easy to specify for
gnusortβ she has seen it done, but it was messy π
so this program is designed to simply and quickly sort multiple large log files, with no need for temporary storage space and no overly large buffers in memory. the memory footprint is generally only a few megs. no cap. π
π OVERVIEW π
- it'll take a number (from
0ton) of file-names on the command line - it opens them for reading and reads CLF format web log data from all of them
- any lines that don't appear to be in CLF format get rejected and displayed on standard-error. NB, they aren't parsed fully β only minimal parsing to determine the date is performed π
if zero files are specified β no error, bestie, it just silently outputs nothing. this is for scripts that use the find command to find log files and which can't be counted on to find any log files. it saves doing an extra check in your shell scripts. so thoughtful of her honestly. π₯Ή
if one file is specified β the data gets read into a 1000 line buffer, and it will be removed from the buffer (and displayed on standard output) in date order. this handles the case of web servers which date entries on the connection time but write them to the log at completion time, and thus generate log files that aren't in order. (Netscape web server does this β she hasn't checked what other web servers do π).
if more than one file is specified β a line will be read from each file, the file that had the earliest time stamp will be read from until it returns a time stamp later than one of the other files. then the file with the earlier time stamp will be read. with multiple files the buffer size is 1000 lines or 100 * the number of files (whichever is larger). when the buffer becomes full the first line will be removed and displayed on standard output. main character buffering behaviour fr fr. β¨
β¨ OPTIONS β¨
-bbuffer-size β specify the buffer-size to use. if0is specified then it means to disable the sliding-window sorting of the data, which improves the speed. β‘-dβ set domain-name mangling to on. this means that if a line starts with as the name of the site that was requested then that would be removed from the start of the line, and theGET /would be changed toGET http://www.company.com/, which allows programs likeWebalizerto produce good graphs for large hosting sites. also it will make the domain name in lower case. π€-vβ be more verbose. she's yapping and honestly? we love that. π£οΈ
π EXIT STATUS π
0β No errors π1β Bad parameters π2β Can't open one of the specified files π¬3β Can't write to output π
π AUTHOR π
this program, its manual page, and the Debian package were written by Russell Coker <russell@coker.com.au>. iconic of him. π«Ά
π SEE ALSO π
go read those next, iykyk. π
and that's the whole page bestie! this one's version0.06, dated and signed off by Russell Coker<russell@coker.com.au>β so if you were wondering who to thank for your nicely merged logs, now you know. mwah. π πΈ
π¦ where this page comes from
- debian bookworm: logtools 0.13e+nmu2
- debian trixie: logtools 0.13e+nmu3 Β· GPL-2.0-only
- ubuntu jammy: logtools 0.13e+nmu2
- ubuntu noble: logtools 0.13e+nmu2
- ubuntu questing: logtools 0.13e+nmu3
- ubuntu resolute: logtools 0.13g Β· GPL-2.0-only
- ubuntu stonking: logtools 0.13g Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms