Configure logging

Last updated:2021-07-20 10:07:43

Configure logging

You can enable and disable logging for buckets in the KS3 console. You can store logs in an existing bucket with logging enabled or create a bucket in the same region to store logs.

Logging in KS3 is disabled by default. You can enable it and set the storage location manually.

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 Bucket list page, click the name of the target bucket. On the page that appears, click Bucket Settings. On the Basic settings tab, click Edit for Log status settings.

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

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 user ID.
bucket bucket_test The bucket name.
time [11/Jan/2016:15:05:35 +0800] The time when the log was uploaded.
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 user ID.
If the requester is an IAM user, the field value is the Base64-encoded user ID/IAM user name.
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 (reserved).
storageclass Standard The storage class of the accessed resource.
usertype - The user type. This field is not displayed for common users by default, and is displayed as kc for CDN users.
nginx_port 80 The NGINX port. Ports 8000 and 4433 are used for access over internal network. Port 80 is used for access over Internet.

Note:

  • The logging latency is one day. You can view the logs of a day in the afternoon of the next day.
  • Any field in the log can be displayed as -, to indicate 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.

问题反馈