How to Monitor a Junos Device Using Trace Logging

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 0.0.0.0 {
    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 10.0.16.2 -> 224.0.0.5 (fe-0/0/0.0, IFL 0x42)
Nov 30 16:07:10 OSPF Version 2, length 48, ID 192.168.19.1, area 0.0.0.1
Nov 30 16:07:10 checksum 0x0, authtype 0
Nov 30 16:07:10 mask 255.255.255.0, hello_ivl 10, opts 0x2, prio 128
Nov 30 16:07:10 dead_ivl 40, DR 10.0.16.1, BDR 10.0.16.2

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.

blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.