Contents
How do I clear the Apache log?
If you have access by SSH to the server, then you can:
- Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this:
- Clear the current file. echo > /var/log/apache/access.log.
- Restart apache.
How do I rotate apache logs?
Use the file /etc/logrotate. conf to change the settings for all your logs. You van change weekly to daily so the logs are rotated every day.
Can I delete Error_log cPanel?
Find command also has an option to remove or delete the contents of the error_log file from the home directory. -delete is a switch that is used to remove all the outputs from the find command. You can use CORNJOB to remove the error_log files with a weekly schedule.
How to clear apache access.log file?
If you have access by SSH to the server, then you can: 1 Gzip the old file (text files compression ratios are really good). If we assume the file is named /var/log/apache/access.log then do this: gzip -c /var/log/apache/access.log > /var/log/apache/access.log.gz 2 Clear the current file echo > /var/log/apache/access.log 3 Restart apache
Is there proper way to clear log files on Unix?
Is there a proper way to clear log files on Unix? You can simply truncate a log file using > filename syntax. For example if log file name is /var/log/foo, try > /var/log/foo as root user. Use the truncate command to shrink or extend the size of each FILE to the specified size.
How to reduce the size of a log file?
You can simply truncate a log file using > filename syntax. For example if log file name is /var/log/foo, try > /var/log/foo as root user. Use the truncate command to shrink or extend the size of each FILE to the specified size.
How to truncate a log file in Linux?
You can simply truncate a log file using > filename syntax. For example if log file name is /var/log/foo, try > /var/log/foo as root user. How to clear the contents of a log file from the command line Say you want to clear the contents of a log file named /var/log/messages, run: