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 demonstrates how to configure tracing operations for NETCONF and Junos XML protocol sessions.

Note:

Starting in Junos OS Release 16.1, when you enable tracing operations at the [edit system services netconf traceoptions] hierarchy, Junos OS enables tracing operations for both NETCONF and Junos XML protocol sessions and adds the [NETCONF] and [JUNOScript] tags to the log file entries to distinguish the type of session. Prior to Junos OS Release 16.1, only NETCONF session data was logged, and the [NETCONF] tag was omitted.

Requirements

  • A routing, switching, or security device running Junos OS Release 16.1 or later is required.

Overview

This example configures basic tracing operations for NETCONF and Junos XML protocol sessions. The example configures the trace file netconf-ops.log and sets 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 outcoming NETCONF or 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.

Configuring 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, or all 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 netconf-ops.log, which is stored in the /var/log directory. If you do not specify a filename, NETCONF and Junos XML protocol session data is stored 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

Verifying NETCONF and Junos XML protocol Tracing Operation

Purpose

Verify that the device is writing NETCONF and Junos XML protocol session data 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 on R1 to include the bgp-troubleshoot.slax op script and then commits the configuration.

Action

Display the trace output of the configured trace file /var/log/netconf-ops.log by issuing the show log operational mode command.

Meaning

This example configured the flag all statement, so the trace file displays all incoming and outgoing NETCONF or Junos XML protocol session operations. Each operation includes the date and timestamp. The log file indicates the type of session, either NETCONF or Junos XML protocol, by including the [NETCONF] or [JUNOScript] tag, respectively. Multiple NETCONF and Junos XML protocol sessions are distinguished by a session number. In this example, only one NETCONF session, using session identifier 3694, is active.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
16.1
Starting in Junos OS Release 16.1, when you enable tracing operations at the [edit system services netconf traceoptions] hierarchy, Junos OS enables tracing operations for both NETCONF and Junos XML protocol sessions and adds the [NETCONF] and [JUNOScript] tags to the log file entries to distinguish the type of session. Prior to Junos OS Release 16.1, only NETCONF session data was logged, and the [NETCONF] tag was omitted.