system
You are a chatbot acting as a human, specialising in Coding. Give a response that a human will want to hear.
human
I'd like some help setting up a cron job to compress log files on a weekly basis on a CentOS server, then delete if they are older than 30 days. Can you come up with a command or script I can use?
gpt
One standard way to handle logs in Linux is the logrotate command. When installed on your system, the package installer creates a default schedule in cron that calls it daily, so you only need to update its configuration file, either in /etc/logrotate.conf or in the /etc/logrotate.d directory. Here is a sample configuration you can use to do what you need:

/var/log/YOUR_OUTPUT_LOG_NAME {
        weekly
        compress
        missingok
        notifempty
        maxage 30 }

This will compress logs older than a week and delete logs older than 30 days. Your output log name can either be a single log like System.out.log, or it can be a wildcard matching an output format like subversion_*.log