Keep FileMaker Server Web Logs at Fixed Paths

If you need to scrounge through the web server’s logs in the file system, the way FileMaker Server stores these on Mac OS can be a bit annoying. You end up with a bunch of files named like this:

 

This presents two problems. First, its difficult to tease out the name of the most recent log, although the shell’s autocomplete helps with that a bit.

 

But the more important issue for me was that it makes somewhere between difficult and impossible to use tools like logwatch or fail2ban to monitor these files. Neither of them handle the default arrangement well. In the case of fail2ban, it may appear to work initially, but does not pick up any newly created log files until restarted.

FileMaker’s version of the Apache configuration lives inside the directory at:

For each log file there will be a line similar to this using the rotatelogs command:

This puts Apache’s rotatelogs command in control of how how the files are managed, using its default naming convention for log rotations. My first thought was to modify the Apache configuration, perhaps even using newsyslog instead of rotatelogs to manage the files.

Unfortunately, changing the naming method breaks the ability to display the logs in the FMS Admin Console. Also unfortunate is that Mac OS versions prior to Yosemite use the older Apache 2.2, and the rotatelogs command in that version supports only a few options.

However, for systems that are running on Yosemite, the rotatelogs command has an option that can easily give us what we need. from the logrotate man page:

Taking the configuration line we used as an example above, we change this to:

After that change we now get the following:

Now accessing the file at error_log will always give us the most recent version of these logs. Perfect!

In total there are 8 lines and three files that need changes. These are:

  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_error_log’ 10M”
  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:TransferLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_access_log’ 10M”
  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_ssl_request_log’ 10M” secure
  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_error_log’ 10M”
  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:TransferLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_access_log’ 10M”
  • /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_request_log’ 10M” secure
  • /Library/FileMaker Server/HTTPServer/conf/httpd.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/error_log’ 10M”
  • /Library/FileMaker Server/HTTPServer/conf/httpd.conf: CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/access_log’ 10M” common
If you happen to make any mistakes, one situation to watch for is that the web based services like WebDirect will work initially, but then fail around midnight. In my case, I had the following logged in error_log:

Simon.

Leave a Reply