Skip to main content

apache master/custom/global access log

Comments

5 comments

  • cPanelMichael
    [quote="SergeiF, post: 1676071">Right now it is real pain to monitor abuse on the machine, due to no central/master apache log. I cannot tail domlogs due to there are thousands of accounts on each machine.
    Hello :) To clarify, is the goal here to have one log file with the data from all of your Apache domlogs combined? If so, you could develop a bash script that combines all of the Apache domlogs into one single log file after the initial logging. Feel free to clarify or let us know if that's not what you are after. Thank you.
    0
  • SergeiF
    Hi, The idea is to have a "live" log of all the domains combined. The bash script will not do, as it is much more efficient to tail the log (and perhaps grep for stuff of interest). Sometimes there is no time before server runs out of memory due to DoS. In anyway, while my message was being aproved by moderator I figured out the answer: The correct place to put the log line is in /var/cpanel/templates/apache2/vhost.local (cp from vhost.default): ........... LogFormat "%V %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" vcommon CustomLog /var/log/httpd/vhost-access_log vcommon
    It can be placed right before closing tag in the file. The ssl_vhost.local should have similar done. Don't forget to configure logrotate to rotate the logs. Now you can tail the access log for all sites to figure which site or IP is affecting your server. Very easy to spot for example wordpress or joomla bruteforces and deal with them (be that botnet or a single machine). This log can also be used as signle watch point for stuff like fail2ban (to deal with bruteforces above) or similar. I hope this will be helpfull for someone in the future. I wander sometimes why this is not done by default. Logs are very important for security purposes. I am not the first one to ask for it: All these were unaswered. Another problem I found is that the WHM will delete all the access logs without archival, once the stats were processed by default. We have disabled that anti-feature.
    0
  • cPanelMichael
    Hello :) I am happy to see you were able to resolve the issue. Thank you for updating this thread with the solution. Note that you are welcome to submit a feature request to have this behavior utilized by default: Submit A Feature Request Thank you.
    0
  • acoma
    You Sir, are a champion!
    0
  • cwdd
    isn't /usr/local/apache/logs/access_log already a combined log of requests? I was happy to find these: /usr/local/apache/logs/fpcgisock /usr/local/apache/logs/access_log /usr/local/apache/logs/error_log /usr/local/apache/logs/httpd.pid /usr/local/apache/logs/suexec_log /usr/local/apache/logs/ssl_scache.dir /usr/local/apache/logs/ssl_scache.pag /usr/local/apache/logs/suexec_log.offset /usr/local/apache/logs/suphp_log
    It may also be worth looking at piped logging and ALSO this site discussing optimization Be sure to check out the cPanel config option for piped logging, too .vB
    0

Please sign in to leave a comment.