access_log.1428958196\naccess_log.1428958346\naccess_log.1428958354\naccess_log.1428959999\naccess_log.1428961279\naccess_log.1430394547\naccess_log.1430424173\nerror_log.1428958367\nerror_log.1428959582\nerror_log.1428962420\nerror_log.1430376447\nerror_log.1430421531\nerror_log.1430438275\nerror_log.1430438850\nfmsadminserver_access_log.1428958145\nfmsadminserver_access_log.1428958321\nfmsadminserver_access_log.1428958351\n...\n
\n
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.
\n\n
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.
\nFileMaker’s version of the Apache configuration lives inside the directory at:
\n/Library/FileMaker Server/HTTPServer/conf\n
For each log file there will be a line similar to this using the rotatelogs command:
\nErrorLog \"||/usr/sbin/rotatelogs '/Library/FileMaker Server/HTTPServer/logs/error_log' 10M\"\n
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.
\nHowever, 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:
\n-L linkname\nCauses 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.\n
ErrorLog \"||/usr/sbin/rotatelogs -L '/Library/FileMaker Server/HTTPServer/logs/error_log' '/Library/FileMaker Server/HTTPServer/logs/error_log' 10M\"\n
error_log\nerror_log.1428958204\nerror_log.1428958347\nerror_log.1428958357\nerror_log.1428958367\nerror_log.1428959582\nerror_log.1428962420\nerror_log.1430376447\nerror_log.1430421531\nerror_log.1430438275\nerror_log.1430438850\n
Now accessing the file at error_log will always give us the most recent version of these logs. Perfect!
\nIn total there are 8 lines and three files that need changes. These are:
\n- \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_error_log’ 10M” \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:TransferLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_access_log’ 10M” \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-fmsadminserver.conf:CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/fmsadminserver_ssl_request_log’ 10M” secure \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_error_log’ 10M” \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:TransferLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_access_log’ 10M” \n
- /Library/FileMaker Server/HTTPServer/conf/extra/httpd-ssl.conf:CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/ssl_request_log’ 10M” secure \n
- /Library/FileMaker Server/HTTPServer/conf/httpd.conf:ErrorLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/error_log’ 10M” \n
- /Library/FileMaker Server/HTTPServer/conf/httpd.conf: CustomLog “||/usr/sbin/rotatelogs ‘/Library/FileMaker Server/HTTPServer/logs/access_log’ 10M” common \n
Invalid rotation size parameter\n\n