Description

This is a quick indication document to explain how to replicate/duplicate a particual log from any existent file("log messages" for example) to a new file.

Symptoms

MX / PTX routers with need to send 1 or several specific logs to another file from where they are being seeing.

Solution

Via following lines you can achieve this duplicate action, on this example I'm matching from device's logs any lines with either content "summit_pic_get_ea_bandwidth" and "JAM". Any line with matching either criteria will be duplicated into the file name you prefer, in this case "TEST" is used.

 

user@MXrouter-re0# show system syslog | display set

#set system syslog file TEST any notice

#set system syslog file TEST match "summit_pic_get_ea_bandwidth| JAM"

#commit

 

user@MXrouter-re0# run show log TEST | last 6

Mar 22 19:22:39.404 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

Mar 22 19:22:39.404 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

Mar 22 19:22:45.407 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

Mar 22 19:22:45.407 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

Mar 22 19:22:51.414 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

 

Above messages were duplicated from log messages as they were appearing in there. But you can also do the steps to duplicate logs from other files as interactive-commands by matching just a certain user and sending the actions of this user to a new file, also from chassisd file, or even traceoption file.

 

user@MXrouter-re0# run show log messages | last 7

Mar 22 19:23:03.451 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

Mar 22 19:23:09.455 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

Mar 22 19:23:09.456 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

Mar 22 19:23:15.481 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

Mar 22 19:23:15.481 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

Mar 22 19:23:21.504 MXrouter-re0 chassisd[30683]: JAM: Invalid I2C ID summit_pic_update_number_of_ports 0

Mar 22 19:23:21.504 MXrouter-re0 chassisd[30683]: summit_pic_get_ea_bandwidth 1234 Unable to get i2cid for FPC 0 PIC 1

 

*In the contrary case, when you need to remove a line from appearing on a file then you can follow directions from KB article KB22177 [juniper.net].

Modification History

2024-03-22 : Article Created