Saturday, September 28, 2013

How to Move /var/adm/messages and syslog messages to differnt location

Take the backup of /etc/syslog.conf  and be carefully will editing syslog.conf becoz only tab space should be there man syslog.conf

Create a link file while moving to different location.

1)# svcs -a |grep -i log
2)svcs -d svc:/system/system-log:default
STATE          STIME    FMRI
online         Aug_30   svc:/milestone/name-services:default
online         Aug_30   svc:/milestone/sysconfig:default
online         Aug_30   svc:/system/filesystem/local:default
online         Aug_30   svc:/system/filesystem/autofs:default

3)# svcadm disable svc:/system/system-log:default

4)# cd /var/adm/
mv messages messages_old_13sep13
# touch messages
# ls -lrth messages
-rw-r--r--   1 root     root           0 Sep 13 06:02 messages

5)cd /var/log/
# mv syslog syslog_old_13sep13
# touch syslog

Iam moving messages and syslog to /u01/messages_syslog/

6)cd  /u01/messages_syslog/

# touch syslog
# touch messages
# chmod 644 *
# ls -lrth
total 2
-rw-r--r--   1 root     root           0 Sep 13 06:05 syslog
-rw-r--r--   1 root     root           0 Sep 13 06:05 messages
#
#
# chown root:root messages
# chown root:sys syslog
# ls -lrth
total 2
-rw-r--r--   1 root     sys            0 Sep 13 06:05 syslog
-rw-r--r--   1 root     root           0 Sep 13 06:05 messages
#

7)creating link files

#
# ln -s /u01/messages_syslog/syslog /var/log/syslog
 ln -s /u01/messages_syslog/messages /var/adm/messages

#
#
# ls -lrth /var/adm/messages
lrwxrwxrwx   1 root     root          29 Sep 13 06:08 /var/adm/messages -> /u01/messages_syslog/messages
#
#
# ls -lrth /var/log/syslog
lrwxrwxrwx   1 root     root          27 Sep 13 06:07 /var/log/syslog -> /u01/messages_syslog/syslog
#

8)# vi syslog.conf (below lines are modified )
#
#*.err;kern.notice;auth.notice                  /dev/sysmsg
*.err;kern.debug;daemon.notice;mail.crit        /u01/messages_syslog/messages
*.info  /u01/messages_syslog/messages
#auth.notice                    ifdef(`LOGHOST', /var/log/authlog, @loghost)

mail.debug                      ifdef(`LOGHOST', /u01/messages_syslog/syslog, @loghost)

user.err                                        /u01/messages_syslog/messages

9)svcadm enable svc:/system/system-log:default

10) chnage /etc/logadm.conf file for log roatation

==============Below are logs performed on real time================


No comments:

Post a Comment