Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All

    Example: Configuring System Logging on Logical Systems

    This example shows how to configure system logging on logical systems and how to view the logs.

    Requirements

    This example has the following requirements:

    • You must have the view privilege for the logical system.
    • Junos OS Release 11.4 or later.

    Overview

    Each logical systems has its individual directory structure created in the /var/logical-systems/logical-system-name directory. This directory 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/log/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 issue the show log, monitor, and file operational mode commands at the logical system level.

    This example shows how to configure system logging on a logical system.

    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.

    set logical-systems lsys1 system syslog host 10.209.10.69 ftp critical set logical-systems lsys1 system syslog allow-duplicates set logical-systems lsys1 system syslog file lsys1-file1 daemon error set logical-systems lsys1 system syslog file lsys1-file1 firewall critical

    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 system logging:

    1. Configure trace operations on the logical system.

      [edit logical-systems lsys1 system syslog]user@host# set host 10.209.10.69 ftp critical user@host# set allow-duplicates user@host# set file lsys1-file1 daemon error user@host# set file lsys1-file1 firewall critical
    2. If you are done configuring the device, commit the configuration.

      [edit]user@host# commituser@host# exit

    Results

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

    user@host# show logical-systems
    lsys1 {system {syslog {host 10.209.10.69 {ftp critical;}allow-duplicates;file lsys1-file1 {daemon error;firewall critical;}}}}

    Verification

    Confirm that the configuration is working properly.

    Verifying That the System Log File Is Operating

    Purpose

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

    Action

    Tip: To make entries in the system log, you can use the start shell command and then use the logger shell command. For example: logger -e "firewall_crit" -p firewall.crit -l lsys1 TEST

    user@host> show log lsys1/lsys1-file1
    Sep 7 14:15:46 host clear-log[2752]: logfile cleared
    Sep  7 14:19:04  host logger: %-: firewall_crit: TEST
    ...
    user@host> file show /var/logical-systems/lsys1/log/lsys1-file1
    Sep  7 14:19:04  host logger: %-: firewall_crit: TEST
    ...

    Published: 2015-01-28