Tuesday, March 16, 2010

Solaris: How to customize the log settings to a flie?

Ex: Customizing the log setting to the file /var/adm/messages.


As we know, since the server is keep on running and log is more and updated to the file /var/adm/messages.
In case of limitation of disk space, we can rotate the log by having last 10 days log, specify in terms of weeks, and restrict the file size.
bash-3.00# ls -lh /var/adm | grep messages
-rw-r--r-- 1 root root 743K Mar 16 12:16 messages
Shows the file size in human readable format.

bash-3.00# logadm -S 10k /var/adm/messages
bash-3.00# ls -lh /var/adm| grep messages
-rw-r--r-- 1 root root 0 Mar 16 12:17 messages
After, restricting the file size to 10kb.

bash-3.00# logadm -A 10w /var/adm/messages
bash-3.00# ls -lh /var/adm/messages
-rw-r--r-- 1 root root 0 Mar 16 12:17 /var/adm/messages
After, restricting the file to have the log of last 10 weeks.

No comments:

Post a Comment