On a Cisco IOS device the command logging buffered 51200 notifications logs most information to the routers memory (obviously you can change that to informational or debugging as required).

When connected to the router via telnet or SSH I can execute the command terminal monitor (term mon) to have these events displayed in my session live as they are happening. When connected via the console this happens automatically.

How can I achieve the same effect on JunOS; When I am adding IGP/EGB neighbors for example, I'd like to see the new adjacencies coming up rather than constantly looking through the logs.

  • 4
    What about start shell, then tail -f <logfile> | grep <interesting-pattern-here> Commented Oct 8, 2013 at 10:52
  • Would this mean I now have to have two session open with the router, one watching the tail output and one to be interactively configuration the device?
    – Baldrick
    Commented Oct 8, 2013 at 10:54

3 Answers 3


'monitor start messages' is roughly equivalent to 'term mon. 'messages' is the name of the log file you want to monitor.

If you don't see the output you expect, you need to change what is logged to given file from 'set configuration system syslog file X ...'.

  • 2
    In addition while using 'monitor start <logfile>' you can use ESC-q to temporarily disable output to the console. Use ESC-q again to re-enable the output. Commented Oct 9, 2013 at 10:10

See below:

    [edit protocols bgp]
    root@vr-device# show
    traceoptions {
        file bgp-log;
        flag packets detail;
    group test {
        type external;
        peer-as 2;
        local-as 1;

[edit protocols bgp] root@vr-device# run monitor start bgp-log

[edit protocols bgp] root@vr-device#

    *** bgp-log ***
    Jun 24 10:58:19.384061 bgp_connect_complete: error connecting to              
    (External AS 2): Socket is not connected
    Jun 24 10:58:33.408670
    Jun 24 10:58:33.408670 BGP RECV ->
    Jun 24 10:58:33.408790 BGP RECV message type 1 (Open) length 59
    Jun 24 10:58:33.408792 BGP RECV version 4 as 2 holdtime 90 id parmlen 30
    Jun 24 10:58:33.408794 BGP RECV MP capability AFI=1, SAFI=1
    Jun 24 10:58:33.408809 BGP RECV Refresh capability, code=128
    Jun 24 10:58:33.408811 BGP RECV Refresh capability, code=2
    Jun 24 10:58:33.408920 BGP RECV Restart capability, code=64, time=120, flags=
    Jun 24 10:58:33.408922 BGP RECV 4 Byte AS-Path capability (65), as_num 2
    Jun 24 10:58:33.409054 advertising graceful restart receiving-speaker-only capability to neighbor (External AS 2)
    Jun 24 10:58:33.409056 bgp_send: sending 59 bytes to (External AS 2)
    Jun 24 10:58:33.409058
    Jun 24 10:58:33.409058 BGP SEND ->
    Jun 24 10:58:33.409060 BGP SEND message type 1 (Open) length 59
    Jun 24 10:58:33.409062 BGP SEND version 4 as 1 holdtime 90 id parmlen 30
    Jun 24 10:58:33.409064 BGP SEND MP capability AFI=1, SAFI=1
    Jun 24 10:58:33.409066 BGP SEND Refresh capability, code=128

run monitor stop

  • 1
    traceoptions in juniper is like debug in cisco, so it should be turned off if you stop troubleshooting Commented Oct 9, 2013 at 7:27
  • 2
    @MilanPrpic ACK, if you get scheduler slip due to RPD being terribly engineered, and you have traceoptions on, JTAC will suggest it is the reason for your RPD slip (as writing to file I/O supposedly is problematic for RPD scheduling)
    – ytti
    Commented Oct 9, 2013 at 8:53

Monitor traffic off interfaces with protocol, sends this to a pcap file like with wireshark, generally on the var/log directory.

monitor traffic interface ge-0/0/0
monitor interface ge-0/0/0
monitor traffic interface ge-0/2/3 matching "proto 89" write-file ospf.cap - matches proto 89 and writes it in ospf.cap
show security flow session ... options

#set system syslog file messages any info – to save all log messages to file “messages”

to show al log messages-

show log messages | match LOGIN | match “Mar 16”
file list detail /var/log = ls –al (to see permitions, etc.)
clear log messages  - to clear the contents of the messages file

monitor start       messages  - live monitoring of messages file
monitor list
monitor stop – to stop all

For more detailed information about a process, under the process level:

#set traceoptions file filenamefil world-readable
#set traceoptions flag all
  • Ron's comment is right on point and far more thorough than my short answer. Great example,I like that you used some of the options and switches used the syntax that enable monitoring of a specific protocol, and the | with MAR 16.
    – Ty Smith
    Commented Sep 15, 2016 at 2:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.