NETCONF and Junos XML Protocol Tracing Operations Overview
You can configure tracing operations for the NETCONF and Junos XML management protocols. NETCONF and Junos XML protocol tracing operations record NETCONF and Junos XML protocol session data, respectively, in a trace file. By default, devices running Junos OS and devices running Junos OS Evolved do not enable NETCONF or Junos XML protocol tracing operations.
You configure NETCONF and Junos XML protocol tracing operations at the [edit system
services netconf traceoptions] hierarchy level. When you enable tracing
operations, the configuration applies to 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.
[edit system services]
netconf {
traceoptions {
file <filename> <files number> <match regular-expression> <size size> <world-readable | no-world-readable>;
flag flag;
no-remote-trace;
on-demand;
}
}
To enable tracing operations and trace all incoming and outgoing data from NETCONF and Junos XML
protocol sessions on a device, configure the flag all statement. You
can also configure the flag debug statement to enable debug-level
tracing. However, we recommend using the flag all option.
You can restrict tracing to only incoming or outgoing session data by configuring the
flag value as either incoming or outgoing,
respectively. Additionally, you can restrict the trace output to include only those
lines that match a particular expression. To use specific match criteria, configure the
match statement and define the regular expression against which to
match the output.
To control the tracing operation from within a NETCONF or Junos XML protocol session,
configure the on-demand statement. This option requires that you start
and stop trace operations from within the session. To start tracing for that session,
issue the following RPC within the session:
<rpc><request-netconf-trace><start/></request-netconf-trace></rpc>
To stop tracing for that session, issue the following RPC:
<rpc><request-netconf-trace><stop/></request-netconf-trace></rpc>
NETCONF and Junos XML protocol tracing operations record session data in the file
/var/log/netconf. To specify a different trace file, configure
the file statement and the filename.
By default, when the trace file reaches 128 KB in size, it is compressed and renamed to
filename.0.gz, then
filename.1.gz, and so on, until there
are 10 trace files. Then the oldest trace file
(filename.9.gz) is overwritten. You can
configure limits on the number and size of trace files by including the file
files number and file size
size statements. You can configure up to a maximum
of 1000 files. Specify the file size in bytes or use
sizek to specify KB,
sizem to specify MB, or
sizeg to specify GB. You cannot configure
the maximum number of trace files and the maximum trace file size independently. If you
configure one option, you must also configure the other option along with a
filename.
By default, access to the trace file is restricted to the owner. You can configure access by
including either the world-readable or
no-world-readable statement. The no-world-readable
statement, which is the default, restricts trace file access to the owner. The
world-readable statement enables unrestricted access to the trace
file.