• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Limiting logs to 30 days

Maris

Basic Pleskian
Hello, how do i set a lifetime for all access logs? Like http, nginx etc. Let's say I would like to hold no more than 30 days of logs in my server and do not archive anything past that. So my server do not hold any log info for what happened before 30 days.
Thanks
 
If you talk about the logs of your hosted domains, for example like this: Plesk Panel > Service Plans > Logs & Statistics > Log rotation & Maximum number of log files

see also: Log Rotation
 
Last edited:
Does it include apache logs or just Plesk admin panel access logs? In my case - i need apache http access logs that register every single web-page request.
 
Well my example was for the domain logfiles under
Code:
/var/www/vhosts/system/*/logs
and as in the link above documented also for individual domains. If this is not what you talk about please specify which logfile you mean.
 
Last edited:
Yep the same one, though despite that i have set Log Rotation monthly, max no of log files = 3, compress log files, there's full of archived log files, god knows kept for how long.. what i want is to see only past 30 days logs, nothing more, no archives from previous year, no nothing, pure past 30 days and that's all
 
Well if you like to get this very old archives deleted you can do this on cmd line for example like:
Code:
# find old archive logs older than 180 days
find /var/www/vhosts/system/*/logs/*.gz -mtime +180

# find and delete them
find /var/www/vhosts/system/*/logs/*.gz -mtime +180  -exec rm {} \;
 
Last edited:
Back
Top