Loggly Apache Missing Access Logs
I’ve been using Loggly to consolidate my server logs for about a month now. Overall I’m extremely satisfied with the service and think that making my server logs more accessible has allowed me to fix issues and provide better service to my clients. I did happen to have one issue though with my Loggly configurations – My apache access logs and error logs weren’t all going into Loggly. My access logs weren’t being sent and things weren’t being formatted the way that they should have. I was missing fields like: remoteAddr, requestUri, requestMethod, and userAgent. Unfortunately I couldn’t find anything in their documentation that would help me trouble shoot my issue. The fact that my access logs weren’t showing at all help point me in the correct direction though.
Loggly’s installation scripts expect your Apache access and error logs to be pointed in the default area ( /var/log/apache2/access.log And /var/log/apache2/error.log) – and mine weren’t. I have multiple domains and configurations set up in my Apache config – all virtual hosts being configured in the /etc/httpd/conf.d/ directory of my server. I had a vhost.conf file that had all my <virtual host directives. Inside the configurations I had specified a specific errorlog and a custom log for access logs. That was my problem. I commented out the specific log directives and restarted apache and suddenly I had access to all the access logs I’d been missing.
<VirtualHost *:80> ServerName http://domain.net ServerAlias www.domain.net DocumentRoot "/var/www/html/domain/public_html" ErrorLog "/var/log/domain.error.log" CustomLog "/var/log/domain.access.log" common DirectoryIndex index.html <Directory "/var/www/html/domain/public_html"> AllowOverride All </Directory> </VirtualHost>
<VirtualHost *:80> ServerName http://domain.net ServerAlias www.domain.net DocumentRoot "/var/www/html/domain/public_html" # ErrorLog "/var/log/domain.error.log" # CustomLog "/var/log/domain.access.log" common DirectoryIndex index.html <Directory "/var/www/html/domain/public_html"> AllowOverride All </Directory> </VirtualHost>