Hello Team,
I am aware logs removal with find command with removal specific days.
below command removal of name_of_log older than 90 days .
find . -type f -name "name_of_log" -mtime +90 -exec rm {} \:
What is the command purge of name_of_log older than 90 days in Linux.
could you please share the command for purge command.
similarly , please share name of the logs nullify more than 90 days .
I am waiting for your valuable reply.
regards,
jeesshansree
You could use:
find /var/log/ -mtime +DAYS -delete
Which I wouldn't recommend because you will be deleting those files without validating them.
To see what those files are first you can use:
find /var/log/ -mtime +DAYS -ls
But a better framework to use is logrotate which is not a daemon, but a binary called by /etc/cron.daily/logrotate.
That binary uses rotation (including retention, and purging) rules defined in /etc/logrotate.conf and /etc/logrotate.d/
You could use:
find /var/log/ -mtime +DAYS -delete
Which I wouldn't recommend because you will be deleting those files without validating them.
To see what those files are first you can use:
find /var/log/ -mtime +DAYS -ls
But a better framework to use is logrotate which is not a daemon, but a binary called by /etc/cron.daily/logrotate.
That binary uses rotation (including retention, and purging) rules defined in /etc/logrotate.conf and /etc/logrotate.d/
Hello @ricardodacosta ,
thank you for share the command and detailed description.
regards,
jeesshnasree
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.