Description

This article explains why a CLI coredump file might be created when displaying long output in JSON format. The recommendation is to not use the JSON format when displaying a non-structured output of log files or any file with huge content for low-end routers and virtual routers.

Symptoms

When displaying long output in JSON format for example:

"show log MESSAGES | match ifOperStatus.*ge-1/0/5 | count | display json"
"file show xxx| display json"

A CLI coredump may be created as shown below:

labroot@host> show system core-dumps
/var/crash/*core*: No such file or directory
-rw-rw----  1 root  wheel    9853186 Aug 24 06:09 /var/tmp/cli.core.0.gz
-rw-rw----  1 root  wheel    9327906 Aug 24 06:26 /var/tmp/cli.core.1.gz
-rw-rw----  1 root  wheel    9331510 Aug 24 06:28 /var/tmp/cli.core.2.gz
/var/tmp/pics/*core*: No such file or directory
/var/crash/kernel.*: No such file or directory
/var/jails/rest-api/tmp/*core*: No such file or directory
/tftpboot/corefiles/*core*: No such file or directory
total files: 3

Solution

The CLI coredump was created due to a memory limitation resulting from the CLI process. The daemons (or any show command action) always produce XML to MGD/CLI. For JSON implementation, the CLI converts the incoming XML to JSON.

In the first example, the CLI tries to convert the entire log MESSAGES file from XML to JSON first, and then applies the matching clause. This leads to memory limitation since the output is huge.

Also, the content of the log MESSAGES file is not structured (all output like one object) unlike the output of other commands (for example show chassis hardware | display json ). Therefore, it is not worth getting output in JSON format.

This issue might be seen in low-end routers and virtual routers because of a memory limitation.

For low-end routers and virtual routers, it is recommended not to use the JSON format when displaying a non-structured output of log files or any file with huge content.