Saving logs to the log file

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

The log file has a maximum capacity. When the log file is full, the system will replace the oldest logs with new logs.

You can enable log file overwrite-protection to stop the device from saving new logs when the log file is full or the storage device runs out of space.

To save logs to the 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 the log file feature.

info-center logfile enable

By default, the log file feature is enabled.

4. (Optional.) Enable log file overwrite-protection.

info-center logfile overwrite-protection [ all-port-powerdown ]

By default, log file overwrite-protection is disabled.

This feature is supported only in FIPS mode.

5. (Optional.) Set the maximum size for the log file.

info-center logfile size-quota size

The default setting is 10 MB.

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

6. (Optional.) Specify the directory to save the log file.

info-center logfile directory dir-name

The default log file directory is flash:/logfile.

This command cannot survive an IRF reboot or a master/subordinate switchover.

7. Save the logs in the log file buffer to the log file.

  • Configure the interval to perform the save operation: info-center logfile frequency freq-sec

  • Manually save the logs in the log file buffer to the log file:logfile save

The default log file saving interval is 86400 seconds.

The logfile save command is available in any view.