How to View Junos Syslog Messages

In the default syslog configuration on the Junos router, logs are saved to a file called messages, which resides in the default log file directory. On M-, MX-, and T-series routers, the default log file directory is /var/log/. On J-series routers, it is /cf/var/log/.

You can view the file from the device with this command:

user@my-device> show log messages
Nov 7 15:24:36 my-device smartd[4239]: atastandbyarmset: ioctl: Inappropriate ioctl for device
Nov 7 15:24:36 my-device smartd[4239]: standby_request: Error: atastandbyarmset(TRUE): Inappropriate ioctl for device
Nov 7 15:31:01 my-device xntpd[4364]: kernel time sync enabled 2001
Nov 7 16:07:10 my-device mib2d[4365]: SNMP_TRAP_LINK_DOWN: ifIndex 195, ifAdminStatus up(1), ifOperStatus down(2), ifName at-1/0/0

In this kind of output, you can see a number of events, each time-stamped and identified by its process and corresponding process ID. But the show log messages command basically concatenates the entire log file to the screen.

If you’re interested in only a subset of the entire log file or if you’re searching for specific criteria, this kind of raw output is difficult to use — or to be honest, bordering on completely useless. To filter the output from the command, specify filter criteria. For example:

user@my-device> show log messages | match mib2d
Nov 7 16:07:10 my-device mib2d[4365]: SNMP_TRAP_LINK_DOWN: ifIndex 195, ifAdminStatus up(1), ifOperStatus down(2), ifName at-1/0/0

By specifying the match condition, only the syslog event containing the string mib2d is returned.

blog comments powered by Disqus
Advertisement

Inside Dummies.com

Dummies.com Sweepstakes

Win $500. Easy.