access_log.1428958196 access_log.1428958346 access_log.1428958354 access_log.1428959999 access_log.1428961279 access_log.1430394547 access_log.1430424173 error_log.1428958367 error_log.1428959582 error_log.1428962420 error_log.1430376447 error_log.1430421531 error_log.1430438275 error_log.1430438850 fmsadminserver_access_log.1428958145 fmsadminserver_access_log.1428958321 fmsadminserver_access_log.1428958351 ...
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:
/Library/FileMaker Server/HTTPServer/conf
For each log file there will be a line similar to this using the rotatelogs command:
ErrorLog "||/usr/sbin/rotatelogs '/Library/FileMaker Server/HTTPServer/logs/error_log' 10M"
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:
-L linkname Causes a hard link to be made from the current logfile to the specified link name. This can be used to watch the log continuously across rotations using a command like tail -F linkname.
ErrorLog "||/usr/sbin/rotatelogs -L '/Library/FileMaker Server/HTTPServer/logs/error_log' '/Library/FileMaker Server/HTTPServer/logs/error_log' 10M"
error_log error_log.1428958204 error_log.1428958347 error_log.1428958357 error_log.1428958367 error_log.1428959582 error_log.1428962420 error_log.1430376447 error_log.1430421531 error_log.1430438275 error_log.1430438850
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
Invalid rotation size parameter