monitoring files in JUNOS

If you want to monitor a growing log file in JUNOS, there is a builtin command for this purpose. For example, if you want to monitor the log file /var/log/messages just run;

user@host> monitor start /var/log/messages

and any change in this file will be displayed on your screen. To stop monitoring simply run;

user@host> monitor stop

This is a very handy command indeed. You can also use “tail -f /var/log/messages” after dropping to freebsd shell though, builtin command has several advantages.  You can also monitor the file based on a pattern i.e if you want to look for error messages real time simply run;

user@host> monitor start /var/log/messages | match error

This is the first post of my juniper notes. I would like to add more if I can get round to. Maybe I can add some useful stuff in run up to my juniper certification.

About: rtoodtoo

Worked for more than 10 years as a Network/Support Engineer and also interested in Python, Linux, Security and SD-WAN // JNCIE-SEC #223 / RHCE / PCNSE


You have a feedback?

Discover more from RtoDto.net

Subscribe now to keep reading and get access to the full archive.

Continue reading