Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Monitoring Logical Systems for Routers and Switches

Logical systems enable you to monitor the operational mode commands for router and switches. For more information, see the following topics:

Example: Running Operational Mode Commands on Logical Systems

This example shows how to set the CLI to a specified logical system view, run operational-mode commands for the logical system, and then return to the main router view.

Requirements

You must have the view privilege for the logical system.

Overview

For some operational-mode commands, you can include a logical-system option to narrow the output of the command or to limit the operation of the command to the specified logical system. For example, the show route command has a logical-system option. To run this command on a logical system called LS3, you can use show route logical-system LS3. However, some commands, such as show interfaces, do not have a logical-system option. For commands like this, you need another approach.

You can place yourself into the context of a specific logical system. To configure a logical system context, issue the set cli logical-system logical-system-name command.

When the CLI is in logical system context mode and you enter an operational-mode command, the output of the command displays information related to the logical system only.

Configuration

Procedure

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To set the CLI to a specific logical system context:

  1. From the main router, configure the logical system.

  2. If you are done configuring the device, commit the configuration.

  3. Set the CLI to view the logical system.

  4. Run an operational-mode command.

  5. Enter configuration mode to edit the logical system configuration.

  6. Exit configuration mode to return to operational mode.

  7. Clear the logical system view to return to the main router view.

  8. To achieve the same effect when using a Junos XML protocol client application, include the <set-logical-system> tag.

Logical System Logging Overview

The Junos OS generates system log messages (also called syslog messages) to record system events that occur on the device.

Each system log message identifies the Junos OS process that generated the message and briefly describes the operation or error that occurred. This reference provides more detailed information about each system log message, and when applicable, describes possible causes of the message and action you can take to correct error conditions.

When a logical system is created, the system log messages known as syslog is configured at the [edit system] hierarchy level. The syslog is written with the same files as the default logical system with the name of the logical system prepended to the syslog message.

Each logical system has a directory structure created in the /var/logical-systems/logical-system-name directory. If the traceoptions are configured under the logical system, then the system log messages are saved in the /var/logical-systems/logical-system-name directory.

Note:

The syslog do not pass to /var/logical-systems/logical-system-name directory, but the traceoptions pass to the /var/logical-systems/logical-system-name directory.

Example: Viewing BGP Trace Files on Logical Systems

This example shows how to list and view files that are stored on a logical system.

Requirements

Overview

Logical systems have their individual directory structure created in the /var/logical-systems/logical-system-name directory. It contains the following subdirectories:

  • /config—Contains the active configuration specific to the logical system.

  • /log—Contains system log and tracing files specific to the logical system.

    To maintain backward compatibility for the log files with previous versions of Junos OS, a symbolic link (symlink) from the /var/logs/logical-system-name directory to the /var/logical-systems/logical-system-name directory is created when a logical system is configured.

  • /tmp—Contains temporary files specific to the logical system.

The file system for each logical system enables logical system users to view trace logs and modify logical system files. Logical system administrators have full access to view and modify all files specific to the logical system.

Logical system users and administrators can save and load configuration files at the logical-system level using the save and load configuration mode commands. In addition, they can also issue the show log, monitor, and file operational mode commands at the logical-system level.

This example shows how to configure and view a BGP trace file on a logical system. The steps can be adapted to apply to trace operations for any Junos OS hierarchy level that supports trace operations.

Tip:

To view a list of hierarchy levels that support tracing operations, enter the help apropos traceoptions command in configuration mode.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them into a text file, remove any line breaks, change any details necessary to match your network configuration, and then copy and paste the commands into the CLI at the [edit] hierarchy level.

Configuring Trace Operations

Step-by-Step Procedure

The following example requires you to navigate various levels in the configuration hierarchy. For information about navigating the CLI, see Using the CLI Editor in Configuration Mode in the CLI User Guide.

To configure the trace operations:

  1. Configure trace operations on the logical system.

  2. If you are done configuring the device, commit the configuration.

Viewing the Trace File

Step-by-Step Procedure

To view the trace file:

  1. In operational mode on the main router, list the directories on the logical system.

  2. In operational mode on the main router, list the log files on the logical system.

  3. View the contents of the bgp-log file.

  4. Filter the output of the log file.

  5. View the tracing operations in real time.

    CAUTION:

    Clearing the BGP neighbor table is disruptive in a production environment.

  6. Run the monitor start command with an optional match condition.

  7. Pause the monitor command by pressing Esc-Q. To unpause the output, press Esc-Q again.

  8. Halt the monitor command by pressing Enter and typing monitor stop.

  9. When you are finished troubleshooting, consider deactivating trace logging to avoid any unnecessary impact to system resources.

    When configuration is deactivated, it appears in the configuration with the inactive tag.To reactivate trace operations, use the activate configuration-mode statement.

  10. To reactivate trace operations, use the activate configuration-mode statement.

Deactivating and Reactivating Trace Logging

Step-by-Step Procedure

To deactivate and reactivate the trace file:

  1. When you are finished troubleshooting, consider deactivating trace logging to avoid an unnecessary impact to system resources.

    When configuration is deactivated, the statement appears in the configuration with the inactive tag.

  2. To reactivate logging, use the activate configuration-mode statement.

Results

From configuration mode, confirm your configuration by entering the show logical-systems A protocols bgp group internal-peers command. If the output does not display the intended configuration, repeat the instructions in this example to correct the configuration.

Verification

Confirm that the configuration is working properly.

Verifying That the Trace Log File Is Operating

Purpose

Make sure that events are being written to the log file.

Action