Logging Overview

Last Updated At: 2025-10-21 09:10:00

Overview

The log management feature allows you to record the detailed access information of a specified source bucket and save the information as log files to a specified bucket for better bucket management.

In a destination bucket, the log path is:

Destination bucket/path prefix{YYYY}/{MM}/{DD}/{time}_{random}_{index}.

A log is generated every 5 minutes, with one record per line. Each record contains multiple fields, which are separated by a space. Note that the size of a log file is up to 256 MB. If the log you generate within the 5 minutes is larger than 256 MB, it will be split into several log files. The currently supported logging fields are shown below:

No. Field Description Example
1 eventVersion Recorded version. 1.0
2 bucketName Bucket Name examplebucket-1250000000
3 qcsRegion Request region. ap-city
4 eventTime Event time (request end time, which is a timestamp in UTC+0 time zone). 2018-12-01T11:02:33Z
5 eventSource User access domain name. examplebucket-1250000000.cos.ap-city.xxx.com
6 eventName Event Name UploadPart
7 remoteIp Source IP address 192.168.0.1
8 userSecretKeyId User access KeyId. AKIDNYVCdoJQyGJ5brTf
9 reservedFiled Reserved field. Reserved field, which is displayed as -.
10 reqBytesSent Request bytes (bytes). 83886080
11 deltaDataSize Change in storage made by the request (bytes). 808
12 reqPath Requested file path. /folder/text.txt
13 reqMethod Request Method put
14 userAgent User UA. cos-go-sdk-v5.2.9
15 resHttpCode HTTP response status code. 404
16 resErrorCode Error Code NoSuchKey
17 resErrorMsg Error message The specified key does not exist.
18 resBytesSent Returned bytes. 197
19 resTotalTime Total time taken for a request (in milliseconds. It is equal to the time between the last byte of the response and the first byte of the request). 4295
20 logSourceType Source type of the log. USER (user access request).
21 storageClass Storage Type STANDARD, STANDARD_IA, and ARCHIVE.
22 accountId ID of the bucket owner. 100000000001
23 resTurnAroundTime Time taken for the request server side (in milliseconds. It is equal to the time between the first byte of the response and the last byte of the request). 4295
24 requester Requester. Root account ID: sub-account ID. If the requester is anonymous, it is displayed as -.
25 requestId Request ID. NWQ1ZjY4MTBfMjZiMjU4NjRfOWI1N180NDBiYTY=
26 objectSize Object size (bytes). 808. If you use multipart upload, the objectSize field will only be displayed when the upload is completed. During the multipart upload process, this field is displayed as -.
27 versionId Object version ID. Random string.
28 targetStorageClass Destination storage type. This field is recorded for requests that initiate a replication operation. STANDARD, STANDARD_IA, and ARCHIVE.
29 referer HTTP referer of the request. *.example.com or 111.111.111.1.
30 requestUri Request URI "GET /fdgfdgsf%20/%E6%B5%AE%E7%82%B9%E6%95%B0 HTTP/1.1"
31 vpcId Whether the request is a VPC request. 0/1

Note:

The destination bucket that stores logs can be the source bucket itself, but this is not recommended.

Based on user needs and business development, COS may add new fields to the access logs. Be sure to handle this accordingly when you parse the logs.

Enabling Log Management

You can quickly enable the log management feature in the tenant console.