The logrotate tool is a log rollback program that comes with the Linux system. It is started by the cron program of the System Planning Service tool and can be used to roll back various system logs. Due to the rapid growth of Oracle listener logs, it needs to be cleaned regularly, so I thought of using this tool. The specific usage is as follows:
1. Add a configuration file
Vi/etc/logrotate. d/oracle-listener
/Oracle/app/oracle/diag/tnslsnr/dtydb3/listener/trace/listener. log {
Daily
Copytruncate
Rotate 7
}
2. Perform a manual test to archive the log file. The following command can be executed manually. If the configuration file is not in the/etc/logrotate/directory, add it to cron.
Logrotate-f/etc/logrotate. d/oracle-listener
Note: The logrotate tool has a serious disadvantage, that is, by sending the HUP restart command to the web server process to truncate and round-robin The current log file. Log rollback in this way will seriously affect the continuity of web Services, so it is not practical for real-time monitoring systems.