Log Service allows you to download logs or query and analysis results to your on-premises machine. This topic describes how to download logs.

Download methods

You can download logs in the Log Service console or by using Cloud Shell, Log Service CLI, or Log Service SDKs.
Notice If you use Cloud Shell, Log Service CLI, or Log Service SDKs, the amount of data that you can download is unlimited. However, you may encounter interruptions due to network errors.
Item Log Service console Log Service CLI on your on-premises machine Cloud Shell Log Service SDK
Maximum amount of data that can be downloaded
  • Logs: 1 million
  • Query and analysis results: 100,000 rows
Unlimited 1 million Unlimited
Deployment N/A Manual installation Automatic deployment Manual deployment
Key N/A Manual configuration Automatic configuration Manual configuration
Download over LAN (no traffic over the Internet and no fees for the traffic) N/A Supported (Log Service CLI must be deployed on an Elastic Compute Service (ECS) instance in the region of the Log Service project from which you want to download data.) Supported only in the China (Shanghai) region Supported (Log Service SDKs must be deployed on an ECS instance in the region of the Log Service project from which you want to download data.)
Integration with Apsara File Storage NAS N/A Manual configuration Automatic configuration Manual configuration

Download logs in the Log Service console

You can download logs or query and analysis results from the Log Service console to your on-premises machine by performing similar operations. In this topic, logs are used to show the download procedure. If you want to download query and analysis results, you can click Download Log on the Graph tab after you execute a query statement.

Notice
  • You can download up to 1 million logs at a time. If the limit is exceeded, only the first 1 million logs are downloaded. If you want to download more than 1 million logs, you can reduce the time range of query and repeat the download operations.
  • You can download up to 100,000 rows of analysis results at a time. If the limit is exceeded, only the first 100,000 rows of analysis results are downloaded. If you want to download more than 100,000 rows of analysis results, you can reduce the time range of query and repeat the download operations.
  • Log Service allows for up to three concurrent download operations within each Alibaba Cloud account. Log Service does not limit the total number of download operations. If more than three download operations are concurrently performed or multiple RAM users are used to download logs at the same time, an error may be reported. In this case, you must wait until other download operations are complete and try again.
  • Log Service stores the export records of only the previous day and deletes export records after one day.
  1. Log on to the Log Service console.
  2. In the Projects section, click the name of the project that you want to view.
  3. Choose Log Storage > Logstores. On the Logstores tab, click the Logstore that you want to view.
  4. Optional:Enter a query statement in the search box, select or specify a time range, and then click Search & Analyze.
    For more information, see Query and analyze logs.
  5. On the Raw Logs tab, choose Log Download > Download Log.
  6. In the Log Download dialog box, configure the following parameters and click OK.
    Log Download
    Parameter Description
    Task Name The name of the download task.
    Log Quantity The number of logs that can be downloaded.
    Data format The data format of the file to which you want to download logs. The CSV and JSON formats are supported.
    • If you select CSV, the column names in the file are generated based on the fields of the first 100 logs. If subsequent logs contain new fields, the new fields are stored in the last column of the file in the JSON format. The name of the last column is empty.
    • If you select JSON, each log is converted to the JSON format and written to the file as a single line.
    Compression Method The method that is used to compress logs. Valid values: gzip, lz4, zstd, and Uncompressed.

    If you want to download a large number of logs, we recommend that you select a compression method. This way, the log volume can be significantly reduced, and the logs can be quickly downloaded.

    Sorting Rule The rule that is used to sort logs.

    After you complete the preceding configurations, click OK. In the Log Export History dialog box, you can view the download task. You can also choose Log Download > Log Export on the Raw Logs tab to open the Log Export History dialog box.

    Wait until the task status changes to Successful. Then, you can click Download to download logs to your on-premises machine.

Use Cloud Shell to download logs

You can use Cloud Shell to download logs. For more information, see Use Cloud Shell to download logs from Log Service.

Note The Cloud Shell server resides in the China (Shanghai) region. If you download logs from a Logstore that does not reside in the China (Shanghai) region, you are charged for data transfer over the Internet. For more information about prices, see the Log Service pricing page.

Use Log Service CLI to download logs

If you want to download a large number of logs, you can use Log Service CLI. For more information, see Overview of Log Service CLI.

Note
  • When you use Log Service CLI to download logs, you must specify your AccessKey pair in commands. If you want to use an Alibaba Cloud account to download logs, you can obtain the AccessKey pair of the Alibaba Cloud account in the User Management console. If you want to use a RAM user to download logs, you must create a RAM user in the RAM console and specify the AccessKey pair of the RAM user in commands.
  • If the Log Service CLI server resides in the same region as the current Log Service project, we recommend that you click Switch to Internal Endpoint. This way, logs can be downloaded faster, and you are not charged for Internet traffic because data is not transferred over the Internet.

Use a Log Service SDK to download logs

If you want to download a large number of logs, you can use a Log Service SDK. For more information, see Overview.