You can use Cloud Shell to download a large number of log files from Log Service and upload the files to Object Storage Service (OSS) within a short period of time. This topic describes how to use Cloud Shell to download logs.

Procedure

  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. In the search box, enter a query statement. Then, select a time range and click Search & Analyze.
  5. On the Raw Logs tab, click the download icon.
  6. In the Log Download dialog box, select Download All Logs with Cloud Shell and click OK.
    Note The Cloud Shell server is located 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 transfers over the Internet. For more information, see Log Service pricing.
  7. In the Download File message, click OK.
  8. Optional:In the Cloud Shell window, upload the downloaded log file to an OSS bucket.
    1. Run the following command to view the OSS buckets that you can manage so that you can determine in which OSS bucket you can store the log file:
      aliyun oss ls
      If the command is successfully run, the system returns a list of OSS buckets that you can manage.
      CreationTime                                 Region    StorageClass    BucketName
      2021-09-24 02:03:08 +0000 UTC        oss-cn-beijing        Standard    oss://fyytset
      2021-09-26 03:27:10 +0000 UTC       oss-cn-hangzhou        Standard    oss://demo
      Bucket Number is: 2
    2. Go to the aliyunlog directory and run the ll command to find the downloaded log file.
      total 8640
      drwxr-xr-x 2 shell shell    4096 Sep 28 10:21 ./
      drwxr-xr-x 6 shell shell    4096 Sep 28 10:24 ../
      -rw-r--r-- 1 shell shell 3198090 Sep 28 10:03 data_20210928_100331.txt 
    3. Upload the log file to the OSS bucket.
      aliyun oss cp data_20210928_100331.txt oss://demo --region cn-hangzhou
      If the following information is returned, the file is uploaded:
      Succeed: Total num: 1, size: 3,198,090. OK num: 1(upload 1 files).
      
      average speed 12792000(byte/s)
      
      0.250823(s) elapsed