< Home

Log Files

Log files of a switch are classified into: user log files and diagnostic log files.
  • A user log file record important operations such as device restart and trap information.
  • A diagnostic log file records the service processing flow and fault information.

Log File Format

User log files and diagnostic log files are stored in the storage path+logfile directory. The file names are log.log and log.dblg respectively. For details about the storage path, see "Overview of the File System" in S2720, S5700, and S6700 V200R019C10 Configuration Guide - Basic Configuration.
<HUAWEI> dir
Directory of flash:/                                                                                                                
                                                                                                                                    
  Idx  Attr     Size(Byte)  Date        Time       FileName                                                                         
    0  drw-              -  Apr 22 2015 11:13:17   lost+found                                                                       
    1  -rw-             14  Dec 05 2018 17:21:22   back_time_a                                                                      
    2  -rw-      1,978,136  Oct 08 2018 10:04:23   help.web                                                                         
    3  drw-              -  Dec 04 2018 19:20:51   logfile                                                                          
    4  drw-              -  Apr 22 2015 11:25:55   pmdata                                                                           
    5  drw-              -  Apr 22 2015 11:25:56   user                                                                             
    6  drw-              -  Nov 29 2017 10:18:42   unimng                                                                           
    7  drw-              -  Apr 22 2015 11:26:04   sysdrv                                                                           
    8  drw-              -  Aug 10 2017 16:57:19   selftest                                                                         
    9  -rw-          9,824  Dec 04 2018 17:23:39   private-data.txt                                                                 
   10  -rw-          6,773  Dec 04 2018 17:23:38   vrpcfg.zip                                                                       
   11  -rw-             14  Dec 05 2018 17:21:22   back_time_b                                                                      
   12  drw-              -  Nov 12 2018 15:08:43   localuser                                                                        
   13  drw-              -  Sep 25 2015 16:13:49   dhcp                                                                             
   14  -rw-         14,416  May 14 2018 11:24:21   oom-killer.txt                                                                   
   15  drw-              -  Apr 17 2018 22:45:07   openmng                                                                          
   16  -rw-              4  Oct 24 2018 16:39:43   snmpnotilog.txt    
<HUAWEI> cd logfile
Directory of flash:/logfile/                                                                                                        
                                                                                                                                    
  Idx  Attr     Size(Byte)  Date        Time       FileName                                                                         
   47  -rw-        800,474  Sep 04 2018 11:09:15   2018-09-04.11-09-02.dblg.zip                                                     
   48  -rw-      1,472,144  Dec 05 2018 16:35:08   log.log                                                                          
   49  -rw-        951,656  Nov 13 2018 21:38:08   2018-11-13.21-37-54.dblg.zip                                                     
   50  -rw-        803,565  Sep 15 2018 03:44:32   2018-09-15.03-44-18.dblg.zip                                                     
   51  -rw-        797,445  Sep 18 2018 20:29:44   2018-09-18.20-29-30.dblg.zip   
  108  -rw-      6,487,049  Dec 05 2018 17:10:57   log.dblg                      
The log information generated by the switch is recorded in the log buffer and then saved to a log file automatically or manually.
  • Automatic save: Since the switch starts, logs in the log buffer will be automatically saved to a log file every 24 hours. This saving interval cannot be configured.
  • Automatic save: When the 64-KB log buffer is full, logs in the log buffer will be automatically saved to a log file. The log buffer size cannot be configured.
  • Manual save: The save logfile or save logfile all command is executed to manually save the log information in the log buffer to a log file. The save logfile command can save only the log information in the user log buffer to a log file. The save logfile all command can save the log information in both the user log buffer and diagnostic log buffer.

When a log file exceeds the specified size, the system compresses it into a zip file and name the zip file date.log.zip and date.dblg.zip, for example, 2013-08-14.04-55-23.log.zip and 2013-09-05.05-15-23.dblg.zip. By default, a log file is compressed when it exceeds 8 MB. To configure the log file size, run the info-center logfile size size command.

Obtaining Log Files

For a specified user log file, run the display logfile file-name command on the device to view the file or download the file to a local directory through FTP. Before running a command to view user log files or obtain user log files through FTP, you are advised to run the save logfile or save logfile all command to save the log information in the log buffer to a log file. For details about how to download log files through FTP, see "Example for Configuring the FTP Server" in the S2720, S5700, and S6700 V200R019C10 Configuration Guide - Basic Configuration.
<HUAWEI> display logfile log.log
################################################################
#     This logfile is generated at slot 0
################################################################

Aug 21 2018 16:46:26 HUAWEI LLDP/4/ADDCHGTRAP:OID 1.3.6.1.4.1.2011.5.25.134.2.5 Local management address is changed. (LocManAddr=b443-26ca-2a50)
Aug 21 2018 16:45:59 HUAWEI %%01GTL/4/STATECHANGED(l)[1]:License state changed from Default to Default.
Aug 21 2018 16:46:28 HUAWEI SNMP/4/COLDSTART:OID 1.3.6.1.6.3.1.1.5.1 coldStart.
Aug 21 2018 16:46:12 HUAWEI %%01PDF/4/OPENPDFRFAIL(l)[4]:Failed to open PDF file in binary read mode when reading private data.
Aug 21 2018 16:46:30 HUAWEI LLDP/4/ADDCHGTRAP:OID 1.3.6.1.4.1.2011.5.25.134.2.5 Local management address is changed. (LocManAddr=192.168.1.253)
Aug 21 2018 16:46:24 HUAWEI %%01UVM/6/CREATEDIR(l)[6]:The directory "flash:/unimng/" is automatically created.
Aug 21 2018 16:46:24 HUAWEI %%01UVM/6/CREATEDIR(l)[7]:The directory "flash:/unimng/ind-cfg/" is automatically created.
Aug 21 2018 16:46:26 HUAWEI %%01VFS/6/DEV_REG(l)[8]:Device flash: registration finished.
Aug 21 2018 16:46:27 HUAWEI %%01IFNET/6/IF_INFO_CHANGE(l)[9]:The interface MEth0/0/1 changed the Baud from 100000000 bit to 10000000 bit.
Aug 21 2018 16:46:27 HUAWEI %%01PDF/4/OPENPDFRFAIL(l)[10]:Failed to open PDF file in binary read mode when reading private data.
Aug 21 2018 16:46:27 HUAWEI %%01ALML/4/ENTUP(l)[11]:Board[0] registers successfully, the barcode is: 2102351XFS0821164023

Diagnostic log files are recorded in binary format to save storage space, because these files record a large amount of information.

For diagnostic log files, as the network scale expands and the network complexity increases, the log information generated by the device keeps increasing. To save storage space and reduce the number of disk write operations, you need to increase the log storage space and save interval of the device. This improves the log processing efficiency and prolongs the service life of storage devices. The log information in diagnostic log files is recorded in binary format. The binary log format has obvious advantages. For example, a binary log file of 8 MB is parsed into a 21 MB text format log file. This proves that binary logs can save storage space, reduce I/O operations, and prolong the lifecycle of storage devices.

The switch can write logs to a log file in binary format. A binary log file consists of two parts:
  • Dynamic part: variable information, such as the time

  • Static part: fixed information

Each log has a unique ID, and static information in each log can be identified by its ID. For this reason, binary log files only record dynamic parameters and unique log ID.

For example, a log whose log ID is 1078464521 contains the following registration information:

The user chose N when deciding whether to reboot the system.

Under normal circumstances, the following information is saved:

2009-5-21 19:46:52 Switch %%01CMD/4/REBOOT(l):The user chose N when deciding whether to reboot the system.

However, when the log is saved in binary format, only dynamic parameters are saved:

Time (2009-5-21 19:46:52) + ID (1078464521) + Dynamic parameter (N)

You can view a binary log file in the following ways:
  • Copy the binary log file to a local directory and use a data dictionary and a log parsing tool.

    A data dictionary is a centralized repository of information about all modules in the system, such as the log ID and format string. It can be generated on the switch using commands. The log parsing tool is an executable file. This tool searches the data dictionary downloaded to the local PC for the static information associated with the log IDs in the binary log file. Then it integrates the static information in the data dictionary with dynamic parameters in the binary log file to create a complete log. Contact technical support personnel to obtain the log parsing tool.

  • Run the display diag-logfile command to check the log information in a binary log file.

    In this case, a complete log is also generated by combing static information with dynamic information. However, this method does not generate an independent data dictionary and does not need a log parsing tool. The entire log parsing process is completed by the system automatically.

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic