Tuesday, February 15, 2011

Production Server/Mailserver Maintanace.

At first, allocate enough space for log partition. Linux system having default log rotation if you want to change you can do customize log rotation automatically.







See here maillog in GB, if no need just clear old log.
Log rotate.

drwxr-xr-x 2 root  root  4.0K Dec  8  2009 mail
-rw------- 1 root  root  504M Feb 15 00:49 maillog
-rw------- 1 root  root  1.1G Feb 10 02:37 maillog.1
-rw------- 1 root  root  469M Jan 31 22:23 maillog.2
-rw------- 1 root  root  1.9G Jan 30 04:17 maillog.3
-rw------- 1 root  root  1.9G Jan 23 04:17 maillog.4

Some of log rotating example:
Create the script name of /usr/bin/rotateapplog:
vi /usr/bin/rotateapplog

#! /bin/bash

TIMESTAMP=$(date +%Y-%m-%d)
cd /home/app/

cp log/production.log log/production.$TIMESTAMP.log

echo "$TIMESTAMP" > log/production.log

echo "done"

Add script as cron:

1 00 * * * /usr/bin/rotateapplog
--------------------------------------------------------------------------------------

4 comments:

vishesh kumar said...

Do you logrotate command to log rotation?

Shrikant Lokhande said...

Yes, I will update on my current post.

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city

Unknown said...

Hey thanks for this amazing post! Thank you so much for sharing the good post, I appreciate your hard work.Keep blogging.
DevOps Training in Electronic City