php-multitail/readme.md

19 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2013-07-05 08:00:34 +00:00
php-multitail is a small utility script to tail a bunch of files and display the results compactly. I wrote it because I thought tail's builtin output format for multiple
2013-07-05 08:22:58 +00:00
files was unusable. The utility launches a tail (or whatever you configure) process for each input file and reads their output until it is killed. Each line is prepended
with the filename's first part with '.' as a delimiter, so 'foo.access.log' turns into 'foo'.
2013-07-05 08:00:34 +00:00
Example output from my server logs:
2013-07-05 08:03:18 +00:00
ooo: 217.69.133.68 - - [05/Jul/2013:00:51:25 +0300] "GET /robots.txt HTTP/1.0" 302 0 "-" "Mozilla/5.0 (compatible; Linux x86_64; Mail.RU_Bot/2.0; +http://go.mail.ru/help/robots)"
2013-07-05 08:00:34 +00:00
stuff: 66.249.75.31 - - [05/Jul/2013:04:11:08 +0300] "GET /robots.txt HTTP/1.1" 404 47 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
stuff: 66.249.75.31 - - [05/Jul/2013:04:11:08 +0300] "GET / HTTP/1.1" 403 135 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
2013-07-05 08:22:58 +00:00
Usage:
2013-07-05 08:24:14 +00:00
php multitail.php /path/to/log/file/or/files [/path/to/more/files [/even/more.log ...]]
2013-07-05 08:22:58 +00:00
You can also use glob patterns. I use it like this:
php multitail.php /var/log/nginx/*.access.log