C H A P T E R  2

Accessing and Maintaining Log Files

Information, error, and alert messages are logged to system log files. Use the system log files to diagnose problems or errors. By configuring the log files, you can direct different categories of messages to files or to the console window. This makes the information in logs more accessible and prevents the occurrence of large log files.

For information about using log files generated by the Solaris Operating System and the Foundation Services, consult the syslog.conf4 and syslogd1M man pages.

For information about using log files generated by the Linux Operating System and the Foundation Services, consult the syslog.conf5 and syslogd8 man pages.

This chapter contains the following sections:


Accessing System Log Files

All information, error, and alert messages generated by the Foundation Services are sent to the system log files. The messages can be processed by client programs or by the Node Management Agent (NMA) on Solaris systems (NMA is not provided for Linux systems). To configure your access to the system log files, edit the/etc/syslog.conf file. You can add or change the message sources, priorities, and message locations according to the syntax described in the syslog.conf4 man page on the Solaris OS or the syslog.conf5 man page on Linux. See the man pages of the individual daemons for details of the error levels used by each service.

All Foundation Services messages have the syslog facility set to local0. You can configure system log files to contain selected categories of messages. Netra HA Suite software has the following error message categories:

For information about error message categories, see the syslog.conf4 man page.

procedure icon  To Redirect Netra HA Suite Messages to a File on the Master Node

This procedure redirects specific categories of messages to log files.

  1. Log in as superuser to the node for which you want to redirect messages.

  2. Open the /etc/syslog.conf file in a text editor.

  3. To redirect the info and notice messages to a log file called logfile, add the following line to the /etc/syslog.conf file:


    local0.info;local0.notice /var/log/logfile
    



    Note - Use tabulation in the /etc/syslog.conf file.



  4. Save the /etc/syslog.conf file and exit the text editor.

  5. Create a /var/adm/logfile file if this file does not already exist:


    # touch /var/log/logfile
    

  6. Restart the syslogd daemon:

    For versions of the Solaris OS earlier than version 10:


    # /etc/init.d/syslog stop
    # /etc/init.d/syslog start
    

    For the Solaris 10 OS and later:


    # svcadm restart svc:/system/system-log
    

    For the Linux OS:


    # /etc/rc.d/init.d/syslog stop
    # /etc/rc.d/init.d/syslog start
    

procedure icon  To Define loghost in /etc/hosts

This procedure configures messages to be sent to a specific node. Use this procedure to prevent disruption of Network File System (NFS) traffic by high volumes of messages from diskless nodes.



Note - Netra HA Suite does not support diskless Linux nodes.



  1. Log in to the master node as superuser.

  2. In a text editor, open the /etc/hosts file for the diskless node.

    If your cluster was created by the nhinstall tool, the /etc/hosts file is located at /export/root/diskless-node-name/etc/hosts.

  3. Remove the loghost state for the localhost entry.

  4. Enter the loghost state for the cgtp0 address of the master node.

    For example:


    10.x.3.y master loghost
    

    If the master node is using a default class C address, 10.x.3.y is the IP address of the cgtp0 interface. The system log messages are directed to the logfile specified for the master node.

  5. Save the /etc/hosts file and exit the text editor.

  6. Restart the syslogd daemon:

    For versions of the Solaris OS earlier than version 10:


    # /etc/init.d/syslog stop
    # /etc/init.d/syslog start
    

    For the Solaris 10 OS and later:


    # svcadm restart svc:/system/system-log
    

    For the Linux OS:


    # /etc/rc.d/init.d/syslog stop
    # /etc/rc.d/init.d/syslog start
    

    System log messages are sent to the node specified in the /etc/hosts file. The node can be the current node or any other peer node. On the specified node, the messages are logged to a file called logfile, specified in the /etc/syslog.conf file. For information about redirecting messages to a nonpeer node, see To Redirect System Log Messages to a Nonpeer Node.


Maintaining System Log Files

This section describes how to manage large system log files and how to remove log files. Use tools such as grep to search the system log file and identify messages for a specific node.

procedure icon  To Redirect System Log Messages to a Nonpeer Node

This procedure redirects system log messages from peer nodes to the system log file on a nonpeer node. This prevents the need to maintain large log files on peer nodes.

  1. Log in to a peer node as superuser.

  2. In a text editor, add the name of the nonpeer node to the /etc/hosts file.

  3. In a text editor, edit the /etc/syslog.conf file as follows:

    1. Remove the line:


      local0.info;local0.notice;local0.crit;local0.warning \
      /var/adm/logfile
      

    2. Add the line:


      local0.info;local0.notice;local0.crit;local0.warning @nonpeer
      

      nonpeer is the name of the nonpeer node, as defined in the /etc/hosts file.

      You can replace @nonpeer with @loghost if loghost is defined in /etc/hosts.

  4. Repeat Step 1 through Step 3 on each peer node.

  5. Log in to the nonpeer node to which you want to redirect the messages.

  6. Create an empty file called /var/adm/logfile:


    # touch /var/adm/logfile
    

  7. Open the /etc/syslog.conf file in a text editor.

  8. Specify logfile as the destination for system log messages by adding the following line to the /etc/syslog.conf file:


    local0.info;local0.notice;local0.crit;local0.warning \
    /var/adm/logfile
    

  9. Restart the syslogd daemon:

    For versions of the Solaris OS earlier than version 10:


    # /etc/init.d/syslog stop
    # /etc/init.d/syslog start
    

    For the Solaris 10 OS and later:


    # svcadm restart svc:/system/system-log
    

    For the Linux OS:


    # /etc/rc.d/init.d/syslog stop
    # /etc/rc.d/init.d/syslog start
    

procedure icon  To Remove Links to Crashed Daemons

Removing old log files might not be sufficient to free space. When a daemon crashes while writing to a log file, a link to the log file still exists after the death of the daemon. Consider the impact on a cluster before shutting down a daemon.

  1. Stop the daemon.

  2. Remove the link to the log file.

  3. Restart the daemon.


Logging NFS Operations

To log NFS operations, perform the following procedure.



Note - Logging NFS operations is not supported on Linux.



procedure icon  To Log NFS Operations

  1. Log in to the master node as superuser.

  2. Open the /etc/nfs/nfslog.conf file in a text editor and add the following line:


    my-tag default_dir=my-dir logformat=extended
    

    where:


    my-tag is the label to identify NFS log messages
    my-dir is the directory that contains the log of the NFS operations

  3. Open the /etc/dfs/dfstab file in a text editor and add the following line:


    share -o log=my-tag shared-nfs
    

    where:


    my-tag is the label to identify NFS log messages
    shared-nfs is the hared directory to which all NFS operations, such as rm and mkdir, are logged.

  4. Restart the NFS server:

    For versions of the Solaris OS earlier than version 10:


    # /etc/init.d/nfs.server start
    

  5. Verify that the shared-nfs directory is being shared:


    # share
    

    You will see output similar to the following displayed in the console window:


    -               /share-nfs   log=my-tag   ""
    

  6. Verify that the nfslogd daemon is running:


    # ps -ef | grep nfslogd
    

    • If the nfslogd daemon is running, you will see output similar to the following:


      root   606   348  0 15:03:37 pts/2    0:00 grep nfslogd
      root   592     1  0 14:51:09 ?        0:00 /usr/lib/nfs/nfslogd
      

    • If the daemon is not running, repeat Step 4 and Step 5.

  7. Test that NFS operations are being logged.

    1. Log in as superuser to a peer node other than the master node.

      This node is referred to as node A.

    2. Mount the share-nfs directory:


      # mount master-node:/share-nfs /mnt 
      

    3. Log in to the master node as superuser.

    4. Create a file:


      # touch myfile
      # chmod 777 myfile
      

    5. Log in to node A and examine myfile:


      # echo TEST myfile
      

    6. Examine the log files on the master node:


      # cat  /share-NFS/nfslog
      

      You should see entries for the NFS operations that you have performed.

  8. Log in to the vice-master node as superuser.

  9. Repeat Step 2 through Step 9.