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
- Log on to the Log Service console.
- In the Projects section, click the name of the project that you want to view.
- Choose . On the Logstores tab, click the Logstore that you want to view.
- In the search box, enter a query statement. Then, select a time range and click Search & Analyze.
- On the Raw Logs tab, click the
icon.
- 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.
- In the Download File message, click OK.
- Optional:In the Cloud Shell window, upload the downloaded log file to an OSS bucket.
- 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:
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
- 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
- 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