View daily-rotated logs with Cloud Toolkit

更新时间:
复制 MD 格式

Log files are essential for monitoring system health and collecting application runtime data. A common practice is to rotate log files daily, which means the filename includes the current date. This makes viewing logs difficult, as you must manually update the command every day to match the new filename. You can use Cloud Toolkit to create a one-time configuration that automatically uses the current date in your command. This eliminates repetitive manual updates and improves your deployment efficiency.

Procedure

This procedure uses /root/xxx/log/eureka-2020-05-21.log as an example log file.

  1. Open your project in IntelliJ IDEA.
  2. In the top menu bar of IntelliJ IDEA, choose Tools > Alibaba Cloud > Deploy to Host....
  3. On the Deploy to Host page, click Advanced.advanced
  4. In the Command field, enter tail -f /root/xxx/log/eureka-$(date +%Y-%m-%d).log.
  5. Click Apply and then Run.