Updated on 2024-06-17 GMT+08:00

Managing Logs

KooCLI provides log recording and management to cache the logs generated during API calling. Log files are stored in the following directories:

  • Windows: C:\Users\{Your Windows username}\.hcloud\log\
  • Linux: /home/{Current username}/.hcloud/log/
  • macOS: /Users/{Current username}/.hcloud/log/

Parameters related to log management:

  • level: log level, which can be info, warning, or error.
  • max-file-size: maximum size (MB) of a single log file. Range: 1 to 100. Default value: 20.
  • max-file-num: the number of retained log files. The value 0 indicates that all log files are retained. Default value: 3.
  • retention-period: the number of days for retaining log files. The value 0 indicates that log files are retained permanently.

If none of the parameters are specified, the default log level is error, a single log file is 20 MB, and 3 files are retained.

Run the following command to set log-related parameters:

hcloud log set --key1=value1 --key2=value2 ...

hcloud log set --level=error --max-file-size=20 --max-file-num=3 --retention-period=30
Configuration successful.

Run the following command to view log-related parameters:

hcloud log show

hcloud log show
{
  "maxFileSize": 20,
  "maxFileNum": 3,
  "logLevel": "error",
  "logRetentionPeriod": 30
}