Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[QFX5100] How to collect logs from the host shell

0

0

Article ID: KB30772 KB Last Updated: 28 Nov 2019Version: 5.0
Summary:

This article describes how to collect Host OS logs from any member on QFX5100, QFX5110 and EX4600 Virtual Chassis (VC) or Virtual Chassis Fabric (VCF) system.

Symptoms:

Sometimes it is required to check and copy logs on a QFX5100 from host for troubleshooting purposes.

Notes:

  • To get into the host shell and collect the host logs, you need the root password.
  •  It is not necessary to collect the logs from host shell for every issue. Collect these only when advised by JTAC.

For the recommended logs to collect when opening a case, refer to KB26813 - [EX /QFX] Data Collection Checklist - Logs/data to collect for troubleshooting.

Solution:

First example to collect host OS logs from standalone chassis: 

  1. Log in to the shell of the host:

    {master:0}
    root@qfx5100> request app-engine ?
    Possible completions:
    cleanup Compute node cleanup /var/tmp and /var/log
    file-copy Copy file from host to vjunos
    offline Shutdown compute node
    reboot Reboot compute node/virtual-machine
    service Start/stop/restart compute node service
    {master:0}

    root@qfx5100> request app-engine host-shell <-- login to host shell with root user
    Last login: Thu Feb 4 11:14:34 from 192.168.1.2
    --- Host 13.2X51-D30_vjunos. built 2014-11-28 09:41:27 UTC
    -sh-4.1#
    -sh-4.1#
    -sh-4.1#
    -sh-4.1#
  2. Zip all the files from the /var/log directory to the file host-logs.tar under /var/log/:

    -sh-4.1# tar -cvf /var/log/host-logs.tar /var/log
    tar: Removing leading `/' from member names
    /var/log/
    /var/log/dmesg.old
    /var/log/messages
    /var/log/wtmp
    /var/log/dmesg
    /var/log/libvirt/
    /var/log/libvirt/lxc/
    /var/log/libvirt/qemu/
    /var/log/libvirt/qemu/vjunos0.log
    /var/log/libvirt/libvirtd.log
    /var/log/libvirt/uml/
    /var/log/stap-server/
    /var/log/stap-server/log
    /var/log/host-logs.log
    /var/log/named.log
    /var/log/tallylog
    /var/log/lastlog
    /var/log/maillog
    /var/log/ntpstats/
    /var/log/btmp
    /var/log/spooler
    /var/log/cron
    /var/log/boot.log
    /var/log/audit/
    /var/log/secure
    /var/log/sa/
    /var/log/sa/sar30
    /var/log/sa/sa07
    /var/log/sa/sa08
    /var/log/sa/sa03
    /var/log/sa/sar04
    /var/log/sa/sar07
    /var/log/sa/sa06
    /var/log/sa/sa31
    /var/log/sa/sar06
    /var/log/sa/sar02
    /var/log/sa/sar31
    /var/log/sa/sa02
    /var/log/sa/sa01
    /var/log/sa/sar05
    /var/log/sa/sa04
    /var/log/sa/sar01
    /var/log/sa/sar03
    /var/log/sa/sa05
    /var/log/watchdog/
  3. Check if the file was created correctly:

    -sh-4.1# ls -al /var/log
    total 101920
    drwxr-xr-x 8 root root 4096 Feb 8 13:52 .
    drwxr-xr-x 24 root root 4096 Jan 13 20:15 ..
    drwxr-xr-x 2 root root 4096 Oct 8 2014 audit
    -rw------- 1 root root 0 Dec 8 00:37 boot.log
    -rw-r--r-- 1 root root 0 Oct 9 2014 btmp
    -rw------- 1 root root 19965658 Feb 8 13:52 cron
    -rw-r--r-- 1 root root 39791 Jan 13 20:07 dmesg
    -rw-r--r-- 1 root root 39791 Jan 13 19:48 dmesg.old
    -rw-r--r-- 1 root root 56197120 Feb 8 13:52 host-logs.tar
    -rw-r--r-- 1 root root 292 Feb 8 13:51 lastlog
    drwxr-xr-x 5 root root 4096 Dec 8 00:37 libvirt
    -rw------- 1 root root 0 Dec 8 00:37 maillog
    -rw-r--r-- 1 root root 838524 Feb 8 13:51 messages
    -rw-r--r-- 1 root root 0 Oct 8 2014 named.log
    drwxr-xr-x 2 root root 4096 Oct 9 2014 ntpstats
    drwxr-xr-x 2 root root 4096 Feb 8 00:00 sa
    -rw------- 1 root root 6811 Feb 8 13:51 secure
    -rw------- 1 root root 0 Dec 8 00:37 spooler
    drwxr-xr-x 2 root root 4096 Dec 8 00:34 stap-server
    -rw------- 1 root root 0 Oct 9 2014 tallylog
    drwxr-x--- 2 root root 4096 Dec 8 00:37 watchdog
    -rw-rw-r-- 1 root utmp 34176 Feb 8 13:51 wtmp
    -sh-4.1# exitrlogin: connection closed
  4. Copy the file from host to the Junos VM.

    {master:0}
    root@qfx5100> request app-engine file-copy from-jhost host-logs.tar to-vjunos /var/tmp log
  5. Check if the file was transferred.  From there you can copy the file to a remote server.

    {master:0}
    root@qfx5100> file list /var/tmp detail

    /var/tmp:
    total blocks: 162988
    drwxrwxr-x 2 root wheel 512 Jul 3 2014 .snap/
    drwxr-xr-x 2 root field 512 Dec 8 00:38 gres-tp/
    -rw-r--r-- 1 root field 56197120 Feb 8 13:54 host-logs.tar
    drwxrwxrwx 2 root wheel 512 Dec 8 00:38 install/
    drwxrwxrwx 2 root wheel 512 Dec 8 00:38 pics/
    -r--r--r-- 1 root field 604 Dec 8 00:31 preinstall_boot_loader.conf
    drwxr-xr-x 2 root field 512 Dec 8 00:38 rtsdb/
    -rw-r----- 1 root field 1602 Jan 13 20:15 sampled.pkts
    -rw-r--r-- 1 root field 0 Jan 13 20:15 stable
    drwxrwxrwt 2 root wheel 512 Dec 8 00:38 vi.recover/
    -rw-r--r-- 1 root field 42 Dec 8 00:32 vjunos-install.log
    total files: 6

 


Second example to collect logs from any member ID in a Virtual Chassis or Virtual Chassis Fabric System. In this example, it describes how to get /var/log from the Host OS of an FPC3 in a Virtual Chassis or a Virtual Chassis Fabric system.

  1. Log into the Virtual Chassis or Virtual Chassis Fabric as a root user, and then redirect to the FPC3 (member 3).

    {master:0}
    root@VC> request session member 3
     
    --- JUNOS 17.2R2.8 built 2017-09-25 20:40:45 UTC

  2. Enable command line interface from the FPC, and log into the host shell of FPC3.

    root@VC:LC:3% cli
    root@VC> request app-engine host-shell
    Last login: Wed Jan 24 17:04:21 from 192.168.1.2
    --- Host 17.2R1.13 built 2017-06-02 05:11:40 UTC
    -sh-3.1#

  3. Use "tar" command to compress the entire /var/log file system from Host OS shell.

    In the example below, fpc3.host.tgz is the given file name.
     

    -sh-3.1# tar -czvf /var/tmp/fpc3.host.tgz /var/log
    tar: Removing leading `/' from member names
    /var/log/
    /var/log/maillog
    /var/log/messages
    /var/log/dmesg.old
    /var/log/audit/
    /var/log/lastlog
    /var/log/cron-20171124.gz
    /var/log/stap-server/
    /var/log/stap-server/log
    /var/log/btmp
    /var/log/cron-20171226.gz
    /var/log/boot.log
    /var/log/vjunos0.log-20180118-1516339801.gz
    /var/log/tallylog
    /var/log/dmesg
    /var/log/ntp.log
    /var/log/sa/
    /var/log/sa/sar20
    /var/log/sa/sar23
    /var/log/sa/sar19
    /var/log/sa/sa22
    /var/log/sa/sa20
    /var/log/sa/sa21
    /var/log/sa/sar16
    /var/log/sa/sa19
    /var/log/sa/sar21
    /var/log/sa/sa16
    /var/log/sa/sa18
    /var/log/sa/sa17
    /var/log/sa/sa24
    /var/log/sa/sar18
    /var/log/sa/sar22
    /var/log/sa/sa23
    /var/log/sa/sar17
    /var/log/wtmp
    /var/log/secure
    /var/log/ntpstats/
    /var/log/libvirt/
    /var/log/libvirt/uml/
    /var/log/libvirt/qemu/
    /var/log/libvirt/qemu/vjunos0.log
    /var/log/libvirt/libvirtd.log
    /var/log/libvirt/lxc/
    /var/log/vjunos0.log.1.gz
    /var/log/vjunos0.log
    /var/log/spooler
    /var/log/watchdog/
    /var/log/vjunos_install_log
    /var/log/named.log
    /var/log/cron
    -sh-3.1#

  4. Copy the file to /var/log of the Host OS; and then exit the Host OS shell.

    -sh-3.1# cp /var/tmp/fpc3.host.tgz /var/log/fpc3.host.tgz
    -sh-3.1# ls -l /var/log/fpc3.host.tgz
    -rw-r--r-- 1 root root 3683929 Jan 24 17:08 /var/log/fpc3.host.tgz
    -sh-3.1#
    -sh-3.1# exit
     
    rlogin: connection closed

  5. From FPC3 CLI prompt, copy the log file from Host OS to Junos /var/tmp folder.

    {linecard:3}
    root@VC> request app-engine file-copy from-jhost fpc3.host.tgz to-vjunos /var/tmp log

  6. Check the Host OS file exists in /var/tmp of the Junos. 

    {linecard:3}
    root@VC> file list /var/tmp/fpc3.host.tgz detail
    -rw-r--r--  1 root  field    3683929 Jan 24 17:09 /var/tmp/fpc3.host.tgz
    total files: 1

    Once confirmed, that the file exists, remove the file from the host using: 


    root@VC> request app-engine host-shell
    Last login: Wed Jan 24 17:04:21 from 192.168.1.2
    --- Host 17.2R1.13 built 2017-06-02 05:11:40 UTC
    -sh-3.1# rm /var/log/fpc3.host.tgz
    -sh-3.1# exit

  7. Exit from FPC3 to Master Routing Engine of the Virtual Chassis or Virtual Chassis Fabric.

    {linecard:3}
    root@VC> exit
     
    root@4M-VCF:LC:3% exit
    logout
    rlogin: connection closed

  8. From Master Routing Engine, copy the file from FPC3 to Master Routing Engine's /var/tmp folder.

    {master:0}
    root@VC> 
    file copy fpc3:/var/tmp/fpc3.host.tgz /var/tmp

  9. Check that the file has been copied to the Master Routing Engine.

    {master:0}
    root@VC> file list /var/tmp/fpc3.host.tgz detail
    -rw-r--r--  1 root  field    3683929 Jan 24 17:10 /var/tmp/fpc3.host.tgz
    total files: 1

To download this file to your local machine, FTP/SFTP server can be used or Jweb session can be used.  

Modification History:
2019-11-28: Added second example to collect logs from any member ID in a VC or VCF System.
2019-05-18: Added note to 'Symptoms' section.
Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search