How to Monitor a Junos Device Using Trace Logging - dummies

How to Monitor a Junos Device Using Trace Logging

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

In addition to logging system events, Junos OS software allows you to monitor events through trace logging. You can specify what you want to trace and where you want the messages to be stored.

The biggest difference between trace logging and system logging is where the logging is actually configured. That is, system logging (as the name implies) is system-wide, whereas tracing is a more localized function of specific protocol and processes.

Because trace logging is used to monitor and troubleshoot protocols, tracing isn’t enabled at the [edit system syslog] level in the configuration hierarchy. Instead, the tracing options (or traceoptions) are configured at the various protocol levels in the configuration hierarchy. For example, if you want to enable traceoptions to monitor the routing protocol OSPF activities, you configure traceoptions under the [edit protocols ospf] hierarchy in the configuration. For example:

[edit protocols]
ospf {
  area {
    interface fe-0/0/0.0;
    interface fe-0/0/1.0;
  traceoptions {
    file ospf-log {
      flag hello error general;

In this example, traceoptions are configured for OSPF. Whenever a hello, error, or general OSPF event occurs, the message is written to the file ospf-log. The trace log file is very similar to the syslog files:

user@my-device> show log ospf-log
Nov 30 16:07:10 OSPF rcvd Hello -> (fe-0/0/0.0, IFL 0x42)
Nov 30 16:07:10 OSPF Version 2, length 48, ID, area
Nov 30 16:07:10 checksum 0x0, authtype 0
Nov 30 16:07:10 mask, hello_ivl 10, opts 0x2, prio 128
Nov 30 16:07:10 dead_ivl 40, DR, BDR

The trace file has the time-stamped OSPF events specified by the traceoptions. Using traceoptions can be quite useful when debugging routing issues within your network.