To display logs using the LogViewer CLI

Purpose

Perform this procedure to start the LogViewer CLI and view one or more logs.

Steps
 

Log in to a station as the nsp user.


Open a console window.


Enter the following:

bash$ /opt/nsp/nfmp/server/nms/bin/logviewer.bash argument options parameter

where

argument is an argument listed in Table 4-1, LogViewer CLI startup arguments

options is one or more of the options listed in Table 4-2, LogViewer CLI startup options

parameter is a parameter listed in Table 4-3, LogViewer CLI startup parameters

Table 4-1: LogViewer CLI startup arguments

Argument

Meaning

--version

Display LogViewer version information.

--help

Display LogViewer CLI help text.

Table 4-2: LogViewer CLI startup options

Option

Meaning

-counter

Prepend a counter number to each displayed log entry.

-parseAll

Parses and display the entire contents of a file before displaying the real-time updates.

-ansi level attribute

Display events and filters using ANSI-specified colors

where

level is a logging level, such as debug

attribute is an ANSI color attribute, such as 42m to specify the color green

-quit

Quit LogViewer after parsing the log files.

Table 4-3: LogViewer CLI startup parameters

Parameter

Meaning

-xml file_name

Read information such as log file, plug-in and filter specifications from the XML file specified by file_name. The LogViewer GUI can export this information to an XML file.

file name

Display the specified file when LogViewer starts.

The LogViewer CLI opens in display mode. If a log file is specified as a startup parameter, the most recent entries in the log file are displayed as they are written to the log file. Otherwise, a cursor is displayed.


Enter command mode by pressing ↵. The following prompt is displayed:

log>

This prompt is called the root prompt. The table below describes the options that are available at the root prompt.

Table 4-4: LogViewer CLI root menu options

Option

Function

open

opens a submenu for choosing the logs to view

include

opens a submenu for specifying which log files to list in the open submenu

filter

opens a submenu for adding, listing or deleting filters

plugin

opens a submenu for adding, listing or delete plugins

options

opens a submenu for configuring LogViewer CLI and GUI options

list

lists the files in the open submenu file list

reset

resets the log message counts

stats

displays LogViewer statistics for the current log

The following options are also available in submenus:

back

goes to the previous menu

root

goes to the root menu

quit

quits LogViewer

return

returns to display mode


Enter the following:

open ↵

The following prompt is displayed:

log-open>

Press ↵ to display the list of available logs.


Perform one of the following:

  1. To view a log in the list, enter the name of a log and press ↵.

  2. To view a log that is not listed, perform the following steps.

    1. Enter the following:

      other ↵

      The following prompt is displayed:

      File Name (full path)?

    2. Enter the absolute or relative path of the log file that you want to open and press ↵. LogViewer opens the file.


Enter the following to enter display mode and view the real-time log updates:

return ↵

LogViewer enters display mode. Log updates are displayed as they occur.


To add a filter that restricts the types of log entries that are displayed during the current LogViewer session, perform the following steps:

  1. Press ↵ to enter command mode.

  2. Enter the following to return to the root menu:

    root ↵

    The following prompt is displayed:

    log>

  3. Enter the following:

    filter ↵

    The following prompt is displayed:

    log-filter>

    Note:

    You can also use commands at this menu level to list and delete filters.

  4. Enter the following:

    add ↵

    The following prompt is displayed:

    Filter name:

  5. Enter a name for the filter and press ↵.

  6. The following prompts are displayed in sequence:

    Level:

    Logger:

    Thread:

    Timestamp:

    Message:

    At each prompt, enter a regular expression to use as a match criterion, if required, and press ↵.

  7. The following prompt is displayed:

    Display Filter? (Y/N):

    Enter y ↵ to apply the filter to the current log display. LogViewer applies the filter.

  8. Enter the following to return to display mode:

    return ↵

    LogViewer enters display mode. The log updates are filtered before they are displayed.


10 

To list the available log files, perform the following steps:

  1. Press ↵ to enter command mode.

  2. Enter the following:

    list ↵

    LogViewer lists the available log files.

  3. Enter the following to return to display mode:

    return ↵


11 

To display statistics about the current LogViewer session, perform the following steps:

  1. Press ↵ to enter command mode.

  2. Enter the following:

    stats ↵

    LogViewer displays statistics about the current session.

  3. Enter the following to return to display mode:

    return ↵


12 

To reset the statistics counters for the current LogViewer session, perform the following steps:

  1. Press ↵ to enter command mode.

  2. Enter the following:

    reset ↵

    LogViewer resets the counters.

  3. Enter the following to return to display mode:

    return ↵


13 

Enter the following to close LogViewer:

quit ↵

End of steps