Description

This article provides example commands to archive and copy logs files between JDM ( Juniper Device Manager) , JCP ( Junos Control Plane) , and Hypervisor on NFX250.

Solution

Below are various archive and copy examples taken from 15.1X53-D45:

Archive all contents of /var/log/ from Hypervisor and move to JDM with a single command:

Execute this command on the Hypervisor:
tar -czvf /var/third-party/hypervisor-CURRENT-DATE.tgz /var/log/*  ( collect this file: hypervisor-CURRENT-DATE.tgz from /var/third-party folder on JDM )

Note: /var/third-party folder is shared between JDM and Hypervisor. This means that you can copy a TAR file in the /var/log folder in Hypervisor to the /var/third-party/ folder, and you can collect that same TAR file in /var/third-party from JDM.
 

Archive and copy /var/log folder from JCP (192.168.1.2) to JDM /var/third-party/ folder while in JDM shell

Tip: Use this option if you have network connectivity from JDM to export logs outside the device.

Execute this command from vJunos0/JCP cli to archive the file:
file archive compress source /var/log/* destination /var/tmp/JCP-CURRENT-DATE.tgz

Execute this command on JDM shell to copy file from JCP /var/tmp location to JDM /var/tmp location: 
scp [email protected]:/var/tmp/JCP-logs.tgz /var/tmp/


Archive and copy /var/log folder from JDM to vjunos0/JCP /var/tmp folder

Tip: Use this option if you have connectivity only from JCP to export the logs from the device   

Execute this command on JDM shell to archive /var/log/ folder on JDM:
tar -czvf /var/tmp/JDM-logs.tgz /var/log/*

Note:   Do not use "file archive compress" command on operational prompt of JDM.  It will result in the error
" /bin/sh: 1: /usr/bin/tar: not found ".  The "file archive compress" command is to be only used on vjunos/JCP.

Execute this command on JDM shell to copy archived file to JCP/vJunos0 :
scp /var/tmp/JDM-logs.tgz 192.168.1.2:/var/tmp/

 

Archive and copy /var/log tar file from hypervisor to vjunos0/JCP /var/tmp folder

Tip: Use this option if you have connectivity only from JCP to export the logs from the device

Execute this command on the hypervisor to archive /var/log folder
tar -czvf /var/tmp/hypervisor-logs /var/log/* 
     
Execute this command on the hypervisor to copy archived file to JCP/vJunos0
scp /var/tmp/hypervisor-logs 192.168.1.2:/var/tmp/
 

Notes:

  1. IP address 192.168.1.2 is an internal management IP address on vJunos0 on 15.1X53-D47 and below.  Beginning with 15.1X53-D470 and higher, the vjunos0 IP address has changed to 192.0.2.2.  
  2. Check the /etc/hosts file on the JDM shell to view the mapping of internal management IP address of various components
root@NFX-JDM :/var/third-party# cat /etc/hosts
127.0.0.1       localhost
192.168.1.1     hypervisor
192.168.1.2     vjunos0  <<<<<<<<<<<<<<<<<<<<<<<
192.168.1.3     vjunos1
192.168.1.4     vsrx
192.168.1.254   jdm NFX-JDM
128.0.0.254     jdm NFX-JDM
192.168.1.5     ipsec-nm
192.168.1.100    vSRX-7
192.168.1.101    vSRX-77

Modification History

2021-09-21: Added note that "file archive compress" should not be used on JDM.
2020-07-23: Added note that IP address of vjunos0 changed to 192.0.2.2 beginning with 15.1X53-D470 and higher