Monitoring a Device Using Trace Logging

In addition to logging system events, Junos OS software allows you to monitor events through trace logging. Trace logging is configured and behaves in almost the exact same way as system logging (see preceding section). That is, you specify what you want to trace and where you want the messages to be stored. The biggest difference in trace logging is where the logging is actually configured. That is, system logging (as the name implies) is systemwide, 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 ...

Get Junos® OS For Dummies®, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.