Updated on 2024-04-15 GMT+08:00

Adding Log Dumps

AOM dumps logs to Object Storage Service (OBS) buckets for long-term storage. To store logs for a long period, add log dumps.

AOM offers both periodic and one-off dump modes. You can choose one of them as required.

  • Periodic dump: Current logs are dumped in real time into an OBS bucket and 1-day logs are divided based on the dump cycle.

    To periodically store logs for a long period, add periodic dumps. For details, see Adding Periodic Dumps.

  • One-off dump: Historical logs are dumped to a log file of an OBS bucket at a time.

    One-off dump is similar to the export function on the Log Search page. You can export up to 5000 logs on that page. When you need to export more logs but the export function cannot meet your needs, dump the logs at a time according to Adding One-Off Dumps.

  • To add a log dump, you must have OBS administrator permissions in addition to AOM and LTS permissions.
  • If you need to dump logs to OBS buckets in real time for long-term storage, use the log dump function of LTS.

Adding Periodic Dumps

For example, when you need to dump the logs of the als0320a component into corresponding files in the /home/Periodical Dump directory of the obs-store-test OBS bucket in real time, and the dump cycle is 3 hours, do as follows:

  1. On the menu bar, choose Monitoring Center.
  2. In the navigation pane, choose Log Analysis > Log Dumps.
  3. Click Add Log Dump in the upper right corner of the page. Then, set parameters according to Table 1 and click OK.

    Table 1 Periodic dump parameters

    Parameter

    Description

    Example

    Dump Mode

    Select Periodic dump.

    Periodic dump

    Filter Criteria

    Logs can be filtered by multiple criteria such as log type, cluster, or namespace, so that you can dump the logs that meet specific criteria.

    Set Log Type to Host, Cluster Name to All custom clusters, and Host to 192.168.0.170.

    Log Group

    Logs can be categorized into logical groups, so that you can dump them based on groups.

    log-group1

    Dump Cycle

    You can divide 1-day logs based on the dump cycle. There are "N" time segments in a day (Number of time segments = 24 hours/Dump cycle). The logs of the same time segment are dumped into the same log file.

    For example, if the dump cycle is set to 3 hours, there are 8 time segments in a day. The logs generated at 00:00–03:00 in a day are dumped to the log file in the Log collection date (format: YYYY-MM-DD) > 00 path, and the logs generated at 03:00–06:00 in a day are dumped to the log file in the Log collection date (format: YYYY-MM-DD) > 03 path. Other time segments can be deduced by analogy.

    3 hours

    Target OBS Bucket

    OBS bucket that stores logs.

    NOTE:

    Before storing logs, ensure that an OBS bucket has been created. You can click View OBS and create a bucket on the OBS console.

    obs-store-test

    OBS Bucket Directory

    OBS bucket directory for storing logs.

    /home/Periodical Dump

    After the periodic dump is added, the new logs of the specified resource will be dumped into the OBS bucket in real time.

    In the preceding example, the logs of host 192.168.0.170 will be dumped into corresponding log files in the /home/Periodical Dump directory of the obs-store-test bucket in real time, and the dump cycle is 3 hours.

    Periodic dump is a near-real-time dump but has latency in minutes. The latency varies depending on log quantity and size. Details are as follows:

    • If the number of logs generated within 5 minutes exceeds 1000 or the log size exceeds 2 MB, the logs are dumped in real time.
    • If the number of logs generated within 5 minutes is less than 1000 or the log size is less than 2 MB, the logs are dumped every 5 minutes.

  4. Download the log files in the OBS bucket to a local host for locating faults.

    1. In the periodic dump list, click the target OBS bucket to go to the Objects page on the OBS console.
    2. On the Objects tab page, find the log files stored in OBS, such as 192.168.0.74_var-paas-sys-log-apm-count_warn.log and 192.168.0.74_var-paas-sys-log-apm-debug_erro.trace.
      Paths of the log files dumped to the OBS bucket: Log file paths are related to the selected log types, as shown in the following table.
      Table 2 Paths of the log files dumped to the OBS bucket

      Log Type

      Log File Path

      Component

      Belong bucket directory > Log group name > Cluster name > Component name > Log collection date (format: YYYY-MM-DD) > File ID (format: 0X)

      For example, obs-store-test > home > Periodical Dump > log-group1 > zhqtest0112n > als0320a > 2019-03-22 > 03.

      Host

      Belong bucket directory > Log group name > CONFIG_FILE > default_appname > Log collection date (format: YYYY-MM-DD) > File ID (format: 0X)

      System

      Belong bucket directory > Log group name > Cluster name > Log collection date (format: YYYY-MM-DD) > File ID (format: 0X)

      Names of the log files dumped to the OBS bucket: Host IPv4 address_Log file source_Log file name. Note that slashes (/) in a log file source must be replaced with hyphens (-). For example, 192.168.0.74_var-paas-sys-log-apm-count_warn.log or 192.168.0.74_var-paas-sys-log-apm-debug_erro.trace.

    3. Select the required log file and click Download to download it to the default download path. To save the log file to a custom path, choose More > Download As.

Adding One-Off Dumps

For example, to dump the logs that contain the warn keyword in the last 30 minutes of als0320a to the /home/One-off Dump directory of the obs-store-test OBS bucket, do as follows:

  1. On the menu bar, choose Monitoring Center.
  2. In the navigation pane, choose Log Analysis > Log Dumps.
  3. Click Add Log Dump in the upper right corner of the page. Then, set parameters according to Table 3 and click OK.

    Table 3 One-off dump parameters

    Parameter

    Description

    Example

    Dump Mode

    Select One-off dump.

    One-off dump

    Filter Criteria

    Logs can be filtered by multiple criteria such as log collection time, cluster, or namespace, so that you can dump the logs that meet specific criteria.

    Set Log Collection Time to Last 30 minutes. Set Log Type to Host, Cluster Name to All custom clusters, Host to 192.168.0.170, and Keyword to warn.

    Log Group

    Logs can be categorized into logical groups, so that you can dump them based on groups.

    NOTE:

    After a dump task is deleted, log groups will also be deleted.

    log-group2

    Target OBS Bucket

    OBS bucket that stores logs.

    NOTE:

    If no OBS bucket is available, click View OBS to create a bucket on the OBS console.

    obs-store-test

    OBS Bucket Directory

    OBS bucket directory for storing logs.

    NOTE:

    By default, logs are stored in the root directory of the OBS bucket.

    /home/One-off Dump

    After the one-off dump is added and the dump status changes to Dumped, the historical logs that meet criteria are dumped into the same log file of the OBS bucket at a time.

    For example, the historical logs that contain the warn keyword in the last 30 minutes of host 192.168.0.170 will be dumped to the log-group2_shard_0(custom).log file in the /home/One-off Dump directory of the obs-store-test bucket at a time.

  4. Download the log files in the OBS bucket to a local host for locating faults.

    1. In the one-off dump list, click the target OBS bucket to go to the Objects page on the OBS console.
    2. On the Objects tab page, find the log file stored in OBS, for example, /home/One-off Dump/log-group2_shard_0(custom).log.

      Paths of the log files dumped to the OBS bucket: OBS bucket > Belong bucket directory. For example, obs-store-test/home/One-off Dump.

      Names of the log files dumped to the OBS bucket: Log file names are related to dump file formats, as shown in the following table.
      Table 4 Names of the log files dumped to the OBS bucket

      Name of Log File

      • Log group name _shard_0(custom), for example, log-group2_shard_0(custom).log
      • Log group name_shard_1(custom)
    3. Select the required log file and click Download to download it to the default download path. To save the log file to a custom path, choose More > Download As.