tencent cloud

Log Collection

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-08-26 14:43:14
Diterjemahkan oleh AI
TokenHub supports delivering logs related to model invocations to Tencent Cloud CLS, helping users audit calls, verify usage, troubleshoot issues, and retain logs long-term. Log collection includes the following two categories:
Log Type
Recorded Content
Recommended
AuditLog
Structured metadata for a single call, such as Request ID, request time, model, service, API Key, client IP address, status code, Token usage, latency, and so on.
Compliance auditing, call tracing, usage verification, security investigation
ActivityLog
Audit log fields, as well as detailed fields such as original request, model response, and log reporting source.
Troubleshooting single requests, analyzing model performance, tracing call chains
Attention:
ActivityLog may contain user inputs and model outputs, resulting in a large data volume. Before enabling this feature, confirm that you have configured the CLS log topic permissions, retention period, and access control according to your business security requirements.

Prerequisites

You have activated Tencent Cloud CLS and granted authorization to the service role TokenHub_QCSLinkedRoleInCloudLogService.
Your current account has the permissions to operate the TokenHub console and to access the target CLS logset and log topics.
Using log delivery incurs CLS-related fees, which are charged according to the CLS billing rules.

Enabling Log Shipping

1. Log in to the TokenHub console.
2. Choose Platform Config > System Config in the left sidebar.
3. In the Log Collection section, select the log type you want to enable, click Enable Now in the corresponding card, and complete the configuration in the Enable Log Delivery dialog box.
After successful enabling, the log card displays the Enabled status and shows the bound logset and log topics. Subsequently generated logs of the corresponding type will be written to the specified CLS log topic.
Configuration Item
Description
Destination Region
Select the region where the target CLS logset is located. It must be consistent with the region where Tokenhub is located.
Log Topic Operation
Select an existing log topic or create a new one as prompted on the page.
Logset
Select the CLS logset for receiving TokenHub logs.
Log topic
Select the CLS log topic for storing the current log type. It is recommended to use different log topics for audit logs and invocation logs to facilitate independent management of permissions, indexes, and retention periods.

Viewing Call Details

Going to CLS Search and Analysis via System Configuration

1. Go to Platform Config > System Config > Log Collection.
2. In the enabled audit log or invocation log card, click Search & Analyze.
3. The page redirects to the corresponding CLS log topic, where you can search logs by field.

Locating a Single Call via Usage Statistics

1. Choose Observability > Usage Statistics in the left sidebar, and then go to the Language Model tab.
2. You can filter invocation records based on the following conditions:
Filter
Description
API Key
View the call records of all keys or a specified Key.
Status
View the call records for all statuses or a specified status code.
Time Range
Supports today, last 7 days, last 30 days, or a custom time range.
Keyword
Supports searching by entering an API Key ID or Request ID.
3. In the invocation record list, view information such as request time, request ID, model, service name/ID, API Key name/ID, status code, and Token usage.
4. In the Operation column, click AuditLog or ActivityLog to view the details of this log. If the corresponding log delivery is not enabled, you cannot view the details of that log type.

Disabling Log Shipping

1. Go to Platform Config > System Config > Log Collection.
2. In the enabled log card, click Disable Delivery and confirm as prompted on the page.
After disabling, TokenHub stops writing new logs to the corresponding CLS log topic. Historical logs already delivered to CLS are not affected, and their retention period and storage fees are processed according to the CLS configuration.
Note:
Audit logs and invocation logs are independent of each other. Disabling one type of log does not affect the delivery status of the other type, nor does it affect model invocation.

Log Field Description

Common Fields for Audit Logs and Call Logs

Category
Field
Type
Description
Basic Request Information
request_id
string
Unique identifier for a request, used for full-link tracing and troubleshooting.
Basic Request Information
created_at
datetime
The start time of the request, in timestamp format.
Basic Request Information
finished_at
datetime
The end time of the request, which can be used to calculate end-to-end latency.
Basic Request Information
status
int
HTTP status code, which includes statuses such as 2xx, 4xx, and 5xx.
Interface and Protocol
api
string
The request path, for example, /v1/chat/completions.
Interface and Protocol
api_type
string
The protocol type, for example, chat, responses, and embedding.
Interface and Protocol
is_stream
bool
Whether the request is a streaming request.
Model Information
model_id
string
The model ID selected by the routing process.
Model Information
model_name
string
Model Name.
Model Information
model_type
string
The model type, for example, llm, embedding, and multimodal.
Authentication and Client
api_key_id
string
API Key ID.
Authentication and Client
auth_type
string
The authentication method, for example, apikey.
Authentication and Client
user_agent
string
Client User-Agent.
Authentication and Client
client_ip
string
The source IP address of the client.
Token Statistics
input_tokens
int
The number of input tokens, which already includes the number of tokens hit by the read cache.
Token Statistics
output_tokens
int
The number of output tokens.
Token Statistics
total_tokens
int
The total number of tokens, total_tokens = input_tokens + output_tokens.
Token Statistics
cache_tokens
int
The number of tokens hit by the read cache.
Token Statistics
thinking_tokens
int
The number of thinking tokens, applicable to deep thinking models.
Performance and Latency
ttft
int(ms)
Time To First Token (TTFT).
Performance and Latency
tpot
int(ms)
Time Per Output Token (TPOT).
Performance and Latency
is_timeout
bool
Whether the request timed out.
Performance and Latency
is_canceled
bool
Whether the request was canceled or disconnected by the client.
Business Identifier
service_type
string
Service Types
The online inference service is set to inference_service.
The TokenPlan Enterprise plan is set to token_plan_enterprise.
Business Identifier
endpoint_id
string
The ID of the online inference service. It is empty in TokenPlan scenarios.
Business Identifier
endpoint_name
string
The name of the online inference service. It is empty in TokenPlan scenarios.
Business Identifier
team_id
string
The ID of the plan, used in TokenPlan scenarios.
Business Identifier
team_name
string
The name of the plan, used in TokenPlan scenarios.

Call Log-Specific Fields

Field
Type
Description
input
string(JSON)
The complete user request body, containing information such as the model, message content, and streaming parameters.
output
string(JSON)
The complete model response. The response structure may vary across different products or APIs. Refer to the actual log content for details.

FAQs

Why Are Logs Not Immediately Visible After Log Shipping Is Enabled?

Logs only record new invocations after the feature is enabled. If you have just completed the configuration, first confirm whether any new model invocations have been generated, and check whether the target region, logset, and log topic are correctly selected.

Does Disabling Log Shipping Affect Model Invocations?

No. Disabling delivery only stops writing new logs and does not affect the normal invocation of the online inference service or TokenPlan.

Where Are Historical Logs Stored?

Historical logs already delivered are retained in CLS. Their retention period, indexing, search analysis, and fees are processed according to the CLS configuration. After TokenHub disables delivery, it does not delete the historical logs in CLS.




Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan