Help Center> ServiceStage> User Guide> Component Management> Component Advanced Setting> Configuring a Log Policy of an Application
Updated on 2023-10-31 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.

You can configure log policies during component deployment. If no configuration is performed, the system collects standard application output logs by default.

Procedure

  1. Choose Advanced Settings > O&M Monitoring.
  2. On the Log Collection tab, click Add Log Policy and set the parameters by referring to the following table. Parameters marked with an asterisk (*) are mandatory.

    Parameter

    Description

    Storage Type

    Select a storage type.

    • HostPath: Mount a host path to a specified container path.
    • Mounting Path: Logs are exported only to the container path. You do not need to mount the host path.

    *Host Path

    This parameter is mandatory when Storage Type is set to HostPath.

    Enter the log storage path on the host.

    *Docker Mounting

    1. Set Mounting Path: Enter the application path to which the data volume 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.
      • 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.

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