Thursday 1 September 2016

Log Purging in UNIX operating system.

Hello Every one,

Hope you all are doing well and having fun as Middleware admin. It's been freeze and no more issue today so lets talk about some other activities than the daily issue. As a Middleware consultant we have lot of other task than installation configuration and daily troubleshooting. Here we are discussing easy process of doing log purging.

We can set the log rotation and purging policy from Websphere console for the JVM logs. But some time you need to clean it manfully or need to set the policy according to the organization standers. In my case I need to purge the JVM logs, http logs and application logs also. In our environment we have policy where we archive the files older than 7 days(week) in .gz format and delete the archived files older than 30 day on monthly basis.

If I want to do this task manfully it will take a lot of time and manual efforts which we don't want to do. So here I am noting down some UNIX command which makes my work easy in file purging. Here in my case I am having SOLARIS as an operating system. The command may require some changes in other UNIX operating system or may be not.

Procedure:


1. Archive the files older than 7 days(week)

find . -name '*.log*' -mtime +7 -exec gzip {} \;


2. Delete the archive files older than 30 days.

find . -name '*.gz'  -mtime +30 -exec rm -f {} \;

Hope this will help you. Kindly comment for your suggestion and quires.  

"Effort only fully releases its reward after a person refuses to quit.”

 Regards,
 Akhilesh B. Humbe

Popular Posts