How to Enable and Use the Log Analysis Service

Updated at:

AI Guardrails works with Simple Log Service to provide intelligent log analysis, a one-stop service for real-time collection, storage, query, and in-depth analysis of security detection logs for AI model inputs and outputs.

Powered by a high-performance log processing engine, it supports second-level retrieval and analysis of tens of billions of log entries, helping you accurately identify anomalous behavior, trace risk sources, optimize security policies, and fully meet compliance and audit requirements.

Log analysis

Enable log analysis

  • If you are a new user, you can enable Simple Log Service and adjust the storage capacity when you activate AI Guardrails. You must also create a service-linked role to complete the activation.

  • If you have already activated AI Guardrails, log on to the AI Guardrails console, then on the Detection Results > Log Analysispage, enable log analysis.

Billing

You are billed based on the log storage capacity that you select, which ranges from 1 to 100 TB. The price is CNY 2 per TB per hour, and charges are billed under AI Guardrails.

Log analysis is billed hourly. Billing starts when you enable the feature, even if no API calls are made or there is no actual usage. To disable the feature and stop billing, go to the AI Guardrails console and open the Detection Results > Log Analysispage. Click Modify Capacity in the upper-right corner. On the configuration change page, change the Log Service option from Yes to No, and then click Buy Now to submit the change. This disables log analysis and stops billing. If this option is not displayed on the page, switch to another region and try again.

Log fields

Field name

Description

Example value

account_id

Account

154XXXX

ram_account_id

RAM account ID

234XXX

region_id

Access endpoint

cn-shanghai

request_id

Request ID

AAAAAA-BBBB-CCCCC-DDDD-EEEEEEEE****

response_detail

Content compliance results such as risk tags and confidence scores

/

service

Service type

query_security_check

total_time

Detection duration

XX ms

used_api_name

Business API

  • TextModerationPlus

  • MultiModalGuard

error_code

Status code

200

error_message

Response message

OK

error_code descriptions

error_code

Status code

Description

200

OK

The request is successful.

400

BAD_REQUEST

Invalid request. This may be caused by incorrect request parameters. Check the request parameters carefully.

408

PERMISSION_DENY

This may be because your account is not authorized, has an overdue payment, is not activated, or is disabled.

500

GENERAL_ERROR

Error. This may be a temporary server-side error. Retry the request. If the error persists, contact us through online support.

581

TIMEOUT

Timeout. Retry the request. If the error persists, contact us through online support.

588

EXCEED_QUOTA

The request rate exceeds the quota.

FAQ

Log query FAQ

Why are the logs empty or missing?

A log entry is generated only when the API returns a successful HTTP 200 response. No logs are generated in the following cases:

  • The service is not actually integrated or there are no API calls

  • API calls fail (non-200 responses)

  • Requests do not match any detection rule

If the API returns a success response but you cannot find any logs, check the following:

  • Make sure that you are viewing the correct region

  • Make sure that you are on the Real-time Protection tab (the Agent Real-time Protection and Agent Behavior Audit tabs are not yet available)

How long is log data retained?

The console retains only the logs from the last 7 days. Historical data older than 7 days cannot be queried directly in the console. For a longer retention period, use Set Storage Duration in the upper-right corner of the page to adjust the storage configuration. The retention period can be 30 to 730 days or a custom number of days.

Can I use a custom SLS Project?

No. AI Guardrails logs are automatically collected by the system and written to Alibaba Cloud Simple Log Service (SLS). The SLS Project and LogStore names are automatically assigned by the system and cannot be changed to a custom Project.

How do I report a missed detection for specific content generated by AI Guardrails?

If AI Guardrails misses some content or returns inaccurate detection results, you can report the issue in the following ways:

  1. On the Log Analysis page, find the RequestId of the corresponding record

  2. Prepare the specific text content that you believe has an issue

  3. Submit your feedback through online support and provide the RequestId and the related text content

The backend looks up the corresponding record by RequestId and makes adjustments.