Tracing L2TP Events for Troubleshooting
The Junos OS trace feature tracks L2TP operations and records events in a log file. The error descriptions captured in the log file provide detailed information to help you solve problems.
This topic refers to tracing L2TP operations on MX Series routers. To trace L2TP operations on M Series routers, see Tracing L2TP Operations.
By default, nothing is traced. When you enable the tracing operation, the default tracing behavior is as follows:
Important events are logged in a file located in the
/var/log
directory. By default, the router uses the filenamejl2tpd
. You can specify a different filename, but you cannot change the directory in which trace files are located.When the trace log file
filename
reaches 128 kilobytes (KB), it is compressed and renamedfilename.0.gz
. Subsequent events are logged in a new file calledfilename
, until it reaches capacity again. At this point,filename.0.gz
is renamedfilename.1.gz
andfilename
is compressed and renamedfilename.0.gz
. This process repeats until the number of archived files reaches the maximum file number. Then the oldest trace file—the one with the highest number—is overwritten.You can optionally specify the number of trace files to be from 2 through 1000. You can also configure the maximum file size to be from 10 KB through 1 gigabyte (GB). (For more information about how log files are created, see the System Log Explorer.)
By default, only the user who configures the tracing operation can access log files. You can optionally configure read-only access for all users.
The following topics describe how to configure all aspects of tracing L2TP operations:
Configuring the L2TP Trace Log Filename
By default, the name of the file that records trace output for
L2TP is jl2tpd
. You can specify a different name with the file
option.
To configure the filename for L2TP tracing operations:
Specify the name of the file used for the trace output.
[edit services l2tp traceoptions] user@host# set file l2tp_logfile_1
Configuring the Number and Size of L2TP Log Files
You can optionally specify the number of compressed, archived trace log files to be from 2 through 1000. You can also configure the maximum file size to be from 10 KB through 1 gigabyte (GB); the default size is 128 kilobytes (KB).
The archived files are differentiated by a suffix in the format .number.gz
. The newest archived file is .0.gz
and the oldest archived file is .(maximum
number)-1.gz
. When the current trace log file reaches
the maximum size, it is compressed and renamed, and any existing archived
files are renamed. This process repeats until the maximum number of
archived files is reached, at which point the oldest file is overwritten.
For example, you can set the maximum file size to 2 MB, and
the maximum number of files to 20. When the file that receives the
output of the tracing operation, filename
, reaches 2 MB, filename
is
compressed and renamed filename.0.gz
, and a new file called filename
is
created. When the new filename
reaches
2 MB, filename.0.gz
is renamed filename.1.gz
and filename
is compressed and renamed filename.0.gz
. This process repeats until there are 20 trace files.
Then the oldest file, filename.19.gz
, is simply overwritten when the next oldest file, filename.18.gz
is compressed and renamed to filename.19.gz
.
To configure the number and size of trace files:
Specify the name, number, and size of the file used for the trace output.
[edit services l2tp traceoptions] user@host# set file l2tp_1 _logfile_1 files 20 size 2097152
Configuring Access to the L2TP Log File
By default, only the user who configures the tracing operation can access the log files. You can enable all users to read the log file and you can explicitly set the default behavior of the log file.
To specify that all users can read the log file:
Configure the log file to be world-readable.
[edit services l2tp traceoptions] user@host# set file l2tp_1 _logfile_1 world-readable
To explicitly set the default behavior, only the user who configured tracing can read the log file:
Configure the log file to be no-world-readable.
[edit services l2tp traceoptions] user@host# set file l2tp_1 _logfile_1 no-world-readable
Configuring a Regular Expression for L2TP Messages to Be Logged
By default, the trace operation output includes all lines relevant to the logged events.
You can refine the output by including regular expressions to be matched.
To configure regular expressions to be matched:
Configure the regular expression.
[edit services l2tp traceoptions] user@host# set file l2tp_1 _logfile_1 match regex
Configuring Subscriber Filtering for L2TP Trace Operations
Starting in Junos OS Release 14.1, you can apply filters to L2TP to limit tracing to particular subscribers or domains. Subscriber filtering simplifies troubleshooting in a scaled environment by enabling you to focus on a reduced set of trace results.
For subscriber usernames that have the expected form of user@domain
, you
can filter on the user, the domain, or both. You can use an asterisk
(*) as a wildcard to substitute for characters at the beginning or
end of either term or both terms to match a greater number of subscribers.
You cannot filter results using a wildcard in the middle of the user or domain terms. For example, the following uses of the wildcard are not supported: tom*25@example.com, tom125@ex*.com.
When you enable filtering by username, traces that have insufficient information to determine the username are automatically excluded.
To configure subscriber filtering:
Specify the filter.
[edit services l2tp traceoptions] user@host# set filter user user@domain
Note:This syntax is different than the syntax used to filter subscribers on M Series routers.
Consider the following examples of using the wildcard for filtering:
Filter results for the specific subscriber with the username, tom@example.com.
[edit services l2tp traceoptions] user@host# set filter user tom@example.com
Filter results for all subscribers whose username begins with tom.
[edit services l2tp traceoptions] user@host# set filter user tom*
Filter results for all subscribers whose username ends with tom.
[edit services l2tp traceoptions] user@host# set filter user *tom
Filter results for subscribers with the username tom at all domains beginning with ex.
[edit services l2tp traceoptions] user@host# set filter user tom@ex*
Filter results for all subscribers at all domains that end with ample.com.
[edit services l2tp traceoptions] user@host# set filter user *ample.com
Filter results for all subscribers whose username begins with tom at domains that end with example.com.
[edit services l2tp traceoptions] user@host# set filter user tom*@*example.com
Configuring the L2TP Tracing Flags
By default, only important events are logged. You can specify which events and operations are logged by specifying one or more tracing flags.
To configure the flags for the events to be logged:
Configure the flags.
[edit services l2tp traceoptions] user@host# set flag flag
Configuring the Severity Level to Filter Which L2TP Messages Are Logged
The messages associated with a logged event are categorized according to severity level. You can use the severity level to determine which messages are logged for the event type. A low severity level is less restrictive—filters out fewer messages—than a higher level. When you configure a severity level, all messages at that level and all higher (more restrictive) levels are logged.
The following list presents severity levels in order
from lowest (least restrictive) to highest (most restrictive). This
order also represents the significance of the messages; for example, error
messages are of greater concern than info
messages.
verbose
info
notice
warning
error
The severity level that you configure depends on the issue that
you are trying to resolve. In some cases you might be interested in
seeing all messages relevant to the logged event, so you specify all
. You can also specify verbose
with the same
result, because verbose
is the lowest (least restrictive)
severity level; it has nothing to do with the terseness or verbosity
of the messages. Either choice generates a large amount of output.
You can specify a more restrictive severity level, such as notice
or info
to filter the messages. By default, the trace
operation output includes only messages with a severity level of error
.
To configure the type of messages to be logged:
Configure the message severity level.
[edit services l2tp traceoptions] user@host# set level severity
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.