Configure logging

Last updated:2021-10-18 16:00:50

Configure logging

You can enable and disable logging for buckets in the Kingsoft Cloud Standard Storage Service (KS3) console. You can store the logs of a bucket in the same bucket itself or create a bucket in the same region to store the logs.

By default, logging is disabled for buckets in KS3. You can enable logging for a bucket and manually specify the storage location.

A log file is named in the format of ks3log_Bucket name_yyyy_MM_dd.log.

Procedure

  1. Log in to the KS3 console and click Bucket in the left navigation pane. On the page that appears, click the name of the target bucket.

  2. On the page that appears, click the Bucket Settings tab. On the Bucket Settings tab, click Basic settings. Then, click Edit for Log status settings.
    image.png

  3. Select Open, set the Log Storage Location parameter, and then click Save. By default, logs are stored in the current bucket. You can also select a bucket in the same region to store logs.
    image.png

Log format

The following table describes the fields in a log. The fields are arranged from left to right and separated with tabs.

Field Example Remarks
bucket_owner NzM0MDEzMzI= The Base64-encoded result of the Kingsoft Cloud account ID.
bucket bucket_test The bucket name.
time [11/Jan/2016:15:05:35 +0800] The time when the log was generated.
remote_ip 219.141.176.229 The request IP address.
requester Anonymous The requester. If the requester is an anonymous user, the field value is Anonymous.
If the requester is a Kingsoft Cloud account, the field value is the Base64-encoded result of the Kingsoft Cloud account ID.
If the requester is an IAM user, the field value is the Base64-encoded result of a string in the format of `ID of the Kingsoft Cloud account/Username of the IAM user.
request_id 1e6ac821e4904e4ca21d3a9e0ce52e25 The request ID.
operation REST.POST.OBJECT The operation. The operation in this example is Post Object.
key - The object key.
request_uri “POST /chenjin.jpg HTTP/1.1” The request URL.
http_status 200 The request status code.
error_code - The error code.
bytes_sent 461 The number of bytes that are sent.
object_size 139008 The size of the accessed resource.
total_time 2 The total request duration, measured in seconds and accurate to milliseconds.
turn_around_time 2 The round trip duration between NGINX and the API server, measured in seconds and accurate to milliseconds.
referer “http://ks3.ksyun.com/console.html” The request referer.
user_agent “Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36” The user agent.
version_id - The version ID. This field is reserved.
storageclass Standard The storage class of the accessed resource.
usertype - The user type. By default, this field is not displayed for regular users. For CDN users, the field value is kc.
nginx_port 80 The NGINX port. Ports 8000 and 4433 are used for access over the internal network. Port 80 is used for access over the Internet.

Note:

  • The logging latency is one day. You can view the logs of a day in the afternoon of the next day.
  • The value of any field in the log can be displayed as -, which indicates unknown data or invalidity of the field for the current request.
  • New fields will be added to the end of KS3 logs as required. Consider compatibility when you develop log processing tools.

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

Insufficient
Outdated
Unclear or awkward
Redundant or clumsy
Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈