Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Trace NETCONF and Junos XML Protocol Session Operations

This example configures tracing operations for NETCONF and Junos XML protocol sessions.

Requirements

  • A device running Junos OS or a device running Junos OS Evolved.

Overview

This example configures basic tracing operations for NETCONF and Junos XML protocol sessions. When you configure tracing operations at the [edit system services netconf traceoptions] hierarchy, the device enables tracing operations for both NETCONF and Junos XML protocol sessions. The system adds the [NETCONF] or [JUNOScript] tag to the log file entries to distinguish the session type.

In this example, you configure the trace file netconf-ops.log. You configure a maximum number of 20 trace files and a maximum size of 3 MB for each file. The flag all statement configures tracing for all incoming and outgoing NETCONF and Junos XML protocol data. The world-readable option enables unrestricted access to the trace files.

Configuration

CLI Quick Configuration

To quickly configure this example, copy the following commands, paste them in 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.

Configure NETCONF and Junos XML Protocol Tracing Operations

Step-by-Step Procedure

To configure NETCONF and Junos XML protocol tracing operations:

  1. For NETCONF sessions, enable NETCONF over SSH.

  2. Configure the traceoptions flag to specify which session data to capture.

    You can specify incoming, outgoing, all, or debug data. This example configures tracing for all session data.

  3. (Optional) Configure the filename of the trace file.

    The following statement configures the trace file /var/log/netconf-ops.log. If you do not specify a filename, the system logs NETCONF and Junos XML protocol session data in /var/log/netconf.

  4. (Optional) Configure the maximum number of trace files and the maximum size of each file.

    The following statements configure a maximum of 20 trace files with a maximum size of 3 MB per file.

  5. (Optional) Restrict the trace output to include only those lines that match a particular regular expression.

    The following configuration, which is not used in this example, matches on and logs only session data that contains “error-message”.

  6. (Optional) Configure on-demand tracing to control tracing operations from the NETCONF or Junos XML protocol session.

    The following configuration, which is not used in this example, enables on-demand tracing.

  7. (Optional) Configure the permissions on the trace file by specifying whether the file is world-readable or no-world-readable.

    This example enables unrestricted access to the trace file.

  8. Commit the configuration.

Results

Verification

Verify NETCONF and Junos XML Protocol Tracing Operation

Purpose

Verify that the device logs NETCONF and Junos XML protocol operations to the configured trace file. This example logs both incoming and outgoing NETCONF and Junos XML protocol data. In the sample NETCONF session, which is not detailed here, the user modifies the candidate configuration to include the bgp-troubleshoot.slax op script and then commits the configuration.

Action

Display the configured trace file by issuing the show log filename operational mode command.

Meaning

This example configures the flag all statement, so the trace file logs all incoming and outgoing data for any NETCONF and Junos XML protocol sessions. Each operation includes the date and timestamp. The log file indicates the session type, either NETCONF or Junos XML protocol, by including the [NETCONF] or [JUNOScript] tag, respectively. The device distinguishes multiple NETCONF and Junos XML protocol sessions by using a unique session number. In this example, only one NETCONF session, using session identifier 3694, is active.