Saving diagnostic logs to a diagnostic log file

By default, the device saves diagnostic logs from the diagnostic log buffer to the diagnostic log file every 24 hours. You can adjust the saving interval or manually save diagnostic logs to the diagnostic log file. After saving diagnostic logs to the diagnostic log file, the system clears the diagnostic log buffer.

The device supports up to 20 diagnostic log files. Each diagnostic log file has a maximum capacity. The diagnostic log files are named as diagfile1.log, diagfile2.log, and so on. When the capacity of diagfile1.log is reached, the system compresses diagfile1.log as diagfile1.log.gz and creates a new log file named diagfile2.log. You can download the compressed diagnostic log files. When the twentieth diagnostic log file is full or the storage device runs out of space, the system deletes the oldest diagnostic log file and creates a new one.

To enable saving diagnostic logs to a diagnostic log file:

Step

Command

Remarks

1. Enter system view.

system-view

N/A

2. Enable the information center.

info-center enable

By default, the information center is enabled.

3. Enable saving diagnostic logs to a diagnostic log file.

info-center diagnostic-logfile enable

By default, saving diagnostic logs to a diagnostic log file is enabled.

4. (Optional.) Configure the maximum size of a diagnostic log file.

info-center diagnostic-logfile quota size

By default, the maximum size of a diagnostic log file is 1 MB.

To ensure normal operation, set the size argument to a value between 1 MB and 10 MB.

5. (Optional.) Specify the directory to save diagnostic log files.

info-center diagnostic-logfile directory dir-name

By default, the diagnostic log file is saved in the diagfile directory under the root directory of the storage device. If the storage device has been partitioned, the diagnostic log file is saved in the diagfile directory on the second partition of the storage device.

The configuration made by this command cannot survive a reboot or an active/standby switchover. (In standalone mode.)

The configuration made by this command cannot survive an IRF reboot or a global active/standby switchover in an IRF fabric. (In IRF mode.)

6. Save the diagnostic logs in the diagnostic log file buffer to a diagnostic log file.

  • Method 1: Configure the interval to perform the saving operation: info-center diagnostic-logfile frequency freq-sec

  • Method 2: Manually save the diagnostic logs in the buffer to a diagnostic log file:diagnostic-logfile save

The default saving interval is 86400 seconds.

The diagnostic-logfile save command is available in any view.