Updated on 2024-09-27 GMT+08:00

Configuring a Log Policy of an Application

ServiceStage allows you to configure application log policies for application components deployed in containers. You can view related logs on the AOM console.

If no log policy is configured, the system collects standard application output logs by default.

  1. Choose Container Settings.
  2. Choose Log Collection > Add Log Policy.
  3. Set the parameters by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    Storage Type

    Select a log storage type.

    • Host Path: Mount a host path to a specified container path.
    • Container Path: Logs are exported only to the container path. You do not need to mount the host path. The ICAgent needs to be upgraded to 5.10.79.

    *Host Path

    This parameter is mandatory when Storage Type is set to Host Path.

    Enter the log storage path on the host.

    *Container Mounting

    1. Set Mount Path to the path to which the data storage is mounted.
      NOTICE:
      • Do not mount a data volume to a system directory such as / or /var/run. Otherwise, an exception occurs. An empty directory is recommended. If the directory is not empty, ensure that the directory does not contain any file that affects application startup. Otherwise, the files will be replaced, causing application startup exceptions. As a result, the application fails to be created.
      • When the data volume is mounted to a high-risk directory, you are advised to use a low-permission account to start the application; otherwise, high-risk files on the host may be damaged.
    2. Set Extended Host Path. This parameter is mandatory when Storage Type is set to Host Path.
      • None: No extended path is configured.
      • PodUID: Pod ID.
      • PodName: Pod name.
      • PodUID/ContainerName: Pod ID or container name.
      • PodName/ContainerName: Pod name or container name.
    3. Set Aging Period.
      • Hourly: Log files are scanned every hour. If the size of a log file exceeds 20 MB, the system compresses the log file to a historical file, dumps the historical file to the directory where the log file is stored, and clears the original log file.
      • Daily: Log files are scanned once a day. If the size of a log file exceeds 20 MB, the system compresses the log file to a historical file, dumps the historical file to the directory where the log file is stored, and clears the original log file.
      • Weekly: Log files are scanned once a week. If the size of a log file exceeds 20 MB, the system compresses the log file to a historical file, dumps the historical file to the directory where the log file is stored, and clears the original log file.

  4. Click OK.

    After the component configuration and deployment are complete, you can view run logs on the AOM console. For details, see Viewing Log Files.