Server.app’s Apache Log Viewer is Fairly Useless
You could be forgiven for thinking that someone forgot to finish the log viewer built into Server.app. It doesn’t seem to show what you might expect, and then when it does, it’s in the same plain format you’d get from Console. If you’re so inclined, it’s not too hard to work around.
In the previous article, I described some methods for streamlining your server’s Apache access log (“Improve OS X Performance by Tweaking Apache Logging, And Options for Rotating Logs”), and in the following two I’ll describe two different methods for setting up log rotation. Regardless of which methods you use, though, you will likely find that Server.app’s built-in Apache log viewing is fairly useless.
No, it’s not you.
I can save you some trouble fiddling and puzzling: it really is as borderline useless as it appears. For example, although it will show you a pop-up list of access logs and error logs, each organised by domain, you won’t actually get that. Instead, all domain error logs will show the same actual error log — which isn’t too surprising, since the log format is not splitting up the errors by domain anyway. And all domain access logs will either be entirely empty or will simply show the exact same ‘combinedvhost’ log, depending on the phase of the moon. Actually, I have no idea what it depends on. It probably isn’t the phase of the moon. All I can say for sure is that virtually every time I check domain access logs in Server.app, it replies with “No contents to display”. However, there have been a few (precious few) occasions on which I have seen something displayed there, just never anything domain-specific and always when the log is relatively small in size.
Note that the above is true even when using Apple’s default ‘combinedvhost’ log format for individual virtual hosts — the only difference in the setup I’ve described in the previous article is that we’ve added the environment variable check to cut down on the unwanted bumpf that would otherwise get logged. (And I’ve checked: it makes no difference whether the relevant CustomLog
directive is present in the vhost configuration as distinct from the httpd_server_app.conf
. Server.app’s domain access logs still show as empty.)
However, even on those occasions where Server.app does have something to display, it shows log lines in the same plain format as Console — no organisation by visit or IP, no parsing out of the individual components of a log line, just the raw lines. If you’d like something more akin to cPanel’s legacy “Latest Visitors” display, this is not too hard to do. (As for cPanel’s current, non-legacy “Latest Visitors” — the JavaScript-heavy version, I mean — I cannot for the life of me understand what use it could possibly be. Either there is something I’m just not getting, or it is completely pointless and utterly unusable for anything you would ever want to do.) It’s just a matter of grabbing a raw log from /private/var/log/apache2
, processing individual lines to consolidate visits by IP, and formatting the data to display more usefully and visually sensibly in a browser.
In my own case, I’m running my own home-grown log viewer for OS X Server, which is designed to parse and display log information in a way that is inspired by cPanel’s legacy viewer, and it works a treat. At some point, I may get around to releasing it for public consumption, as it can be a huge help having something decent to look at when checking raw traffic as recorded by the server, as distinct from higher level analytics provided by Google Analytics and the like. (If this is particularly of interest to you, drop me an email, and it will nudge me that much closer to whipping it into shape for public release. Contact page is here: “About Coded Memes and How to Get in Touch”.)
All material on this site is carefully reviewed, but its accuracy cannot be guaranteed, and some suggestions offered here might just be silly ideas. For best results, please do your own checking and verifying. This specific article was last reviewed or updated by Greg on .