What are the server log files and how do I clear them?
The server log files record activity on your virtual server, including Web, Mail, and FTP access. The log files can provide useful information about your web site when using tools such as WebTrends and Getstats. Note that you should clear these logs periodically as they will continue to grow in size until they consume all of your allocated disk space. The growth rate of the log files is directly related to how popular your web site is (Web, Mail, and FTP activity are all logged). Clearing Log Files You can manually clear the server log files by using the vnukelog command at the telnet shell prompt. This command will clear all log files in the ~/www/logs directory (logs of web server activity) and the ~/usr/log/messages log file (log of FTP and MAIL activity). To clear an individual log file, change to the directory where the log file resides and type: cp /dev/null <log file name> Note that it is not a good idea to remove the log files by just deleting them (i.e. "rm logfile"), as this can cause hung processes on the server. If a process hangs while manually deleting a file, the disk space the file was consuming is not returned for use. If this happens to you, please notify support and we will clear the hung processes. Automatic Log Clearing You can set up cron jobs to automatically clear the logs or run statistical reports such as getstats on a pre-determined basis. If your web site is a low traffic site, then once a month may be good enough. If your web site is high traffic, you may find the need to clear your logs twice a month, once a week, or even daily. You can even turn off log generation altogether if you are not interested in knowing how many people are viewing your site, where they are coming from or what they are doing while at your site. Below are some examples on using cron to clear your logs automatically:
After you have created a cronfile, install and activate it using: % crontab cronfile For more information on Turning Off Log Generation The Apache Server Configuration File allows you to customize log generation for your specific situation, including turning off log generation altogether. To effectively turn off web server logging, edit your virtual server's httpd.conf file and change the logfile entries as follows: TransferLog /dev/null
AgentLog /dev/null
RefererLog /dev/null
ErrorLog /dev/null
Note that this will not turn off the server messages log that is generated by FTP or MAIL activity. You will have to use one of the other options described above to clear it on a periodic basis. |