||How to view the latest rotated apache log in linux.
A quick way to get the latest rotatelogs-generated logfile, and tail it.
Lets say your dataset is:
this will do the trick.
tail -f `ls -1t httpd_error* | head -1`
tail -f `ls -1t httpd_access* | head -1`
I *don't* think this requires GNU ls, but *BSD users could give it a whirl. All other options work on any unix that has the tail and head commands. IOW, pretty much anything.
Have fun, and play around with it and look at the options. This is a great trick some of us who admin large sites use in a quick and dirty rush to get at the latest log, this second.
Works for more than just apache logs, as well. Anything that is rotated and has a non-distinct logfile for the latest log, can use this.
© 2007 O'Reilly Media, Inc.
| Customer Service:
| Book issues:
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.