Ingest Tencent Cloud log data

更新时间:
复制 MD 格式

In multi-cloud environments, security logs are scattered across cloud providers, making unified threat detection and emergency response difficult. The Agentic SOC feature of Security Center supports centralized import and analysis of Tencent Cloud security product logs, such as WAF and Cloud Firewall, to enable unified security management across cloud environments.

How it works

  • Aggregate logs at the source: Logs from Tencent Cloud products such as WAF are consolidated into Tencent Cloud Log Service (CLS).

  • Export data: CLS exports log data to a message queue (Kafka) or object storage (COS), which serves as a staging node for cross-cloud data transfer.

  • Import data across clouds: Agentic SOC subscribes to and pulls log data from DMS or COS using standard Kafka or S3 protocols, and delivers it to a designated data source.

  • Ingest and normalize: Create an ingestion policy in Agentic SOC and apply standardization rules to parse and normalize the raw logs before storing them in the data warehouse.

Supported logs

This solution supports importing only the following Tencent Cloud log types:

  • Web Application Firewall (WAF) alert logs

  • Cloud Firewall (CFW) alert logs

Ship logs to CLS

Before importing logs, ship security product logs from Tencent Cloud to Cloud Log Service (CLS).

Web Application Firewall

For detailed instructions, see the official Tencent Cloud documentation: WAF - Log shipping.

  • Authorize and enable log service

    • Log in to the Web Application Firewall console. On the Access Log > Log shipping or Attack Log > Log shipping page, click Configure and follow the prompts to complete authorization.

    • After authorization, click Create on the log shipping page.

    After authorization, the system automatically creates a Logset named waf_post_logset.

  • Enable log shipping

    Enable log shipping for the logs you want to collect. For details, see Enable log shipping.

    • Enable attack log shipping: In the WAF console, choose Instance Management in the left navigation pane. On the instance details page, turn on Attack log shipping.

    • Enable access log shipping:

      • In the WAF console, choose Connection Management > Domain names. In the Actions column, click More > Log shipping.

      • In the advanced settings window, set Delivery target to CLS and click Save.

Cloud Firewall

For detailed instructions, see the official Tencent Cloud documentation: Cloud Firewall - Log shipping.

  • Create a sub-account with permissions

    You can also use a key from the main account in API Key Management.

    • We recommend creating a dedicated API account for the firewall log shipping task on the Access Management - User List page and granting it full read/write permissions for CLS: QcloudCLSFullAccess.

    • On the API Key tab of the User Details page, click Create Key and securely store the generated SecretId and SecretKey (click Download CSV File or copy them to a local file). For more information, see Sub-account access key management.

  • Ship logs to CLS

    • In the Cloud Firewall console, on the Log Analysis page in the Log Shipping section, select the Ship to CLS tab.

    • In the Configure CLS Delivery section, enter the sub-account key (SecurityID and SecurityKey) created in the previous step for authentication.

    • Turn on the Shipping switch for the desired logs, such as attack logs or access control logs.

    After you enable shipping, view the CLS log topic information in the Log Topic ID/Name column.

Choose an import method

Import CLS logs from Tencent Cloud into Security Center using Kafka protocol consumption or COS. The two methods differ in real-time performance, cost, and configuration complexity. Choose based on your scenario.

CriteriaKafka protocol consumptionCOS
Real-time performanceNear real-time.Minute-level latency.
Configuration complexityLow. Requires Kafka protocol consumption configuration.Low. Requires COS shipping task configuration.
CostTencent Cloud: Log Service fees. Alibaba Cloud: Agentic SOC log ingestion traffic fees.Tencent Cloud: COS storage fees. Alibaba Cloud: Agentic SOC log ingestion traffic fees.
Best forHigh real-time requirements for log analysis, such as stream-based security computing or rapid alert response.Lower real-time requirements, with focus on cost efficiency, log archival, or batch offline analysis.

Configure data import

Import data using Kafka protocol consumption

Step 1: Configure Kafka protocol consumption and obtain access keys on Tencent Cloud

Create a CLS-to-Kafka protocol consumption task. For detailed instructions, see the official Tencent Cloud documentation: Consume logs over Kafka.

  • Enable Kafka protocol consumption

    • Go to the Tencent Cloud - Log Topic page and select the corresponding log storage region in the upper-left corner.

    • Click the target Log Topic name to open its details page.

    • In the left navigation pane, click Consumption over Kafka. On the Basic Information tab, click Edit and turn on Current Status. Configure the following settings, then click OK.

      • Timestamp range: History + Latest.

      • Consumer data format: JSON (select Disable Escape) or Raw Content.

      • Data compression format: No Compression.

      • Public access: Enabled.

      • Service log: Enabled.

  • Get the Kafka service connection details

    After configuration, click View Consumer Parameters to get the required connection details: the CLS public service address (endpoint), username, and consumer topic for use in subsequent steps.

    ParameterDescription
    Public endpointFormat: kafkaconsumer-${region}.cls.tencentcs.com:9096.
    Consumer topicThe Kafka topic.
    UsernameSet to ${LogSetID} (the Logset ID).
    PasswordSet to ${SecretId}#${SecretKey}.

Set up access keys

Step 2: Configure Kafka log import in Alibaba Cloud

Grant Security Center access to Kafka

    Access the Security Center console - System Settings - Feature Settings. At the top of the left side of the page, select the region where the asset to be protected is located: Chinese Mainland or Outside Chinese Mainland.
  • On the Multi-cloud Configuration Management tab, select Multi-cloud Assets, then click Grant Permission. In the panel, configure:

  • Configure synchronization policy

    AK Service Status Check: Set the interval for Security Center to automatically verify Tencent Cloud account access key validity. Select "Disable" to turn off this check.

Create a data import task

  • Create a data source

    Create a dedicated Agentic SOC data source for Tencent Cloud log data. Skip this step if you already have one.

  • Configure the target data source

    • Data source name: Select the data source created in Step 1.

    • Target Logstore: Automatically fetched from the selected data source.

    • Click OK to save the configuration. After configuration, Security Center automatically pulls logs from Tencent Cloud.

Import data using COS

Step 1: Prepare COS storage and obtain access keys on Tencent Cloud

Create a CLS-to-COS shipping task. For detailed instructions, see the official Tencent Cloud documentation: Create a COS shipping task.

  • Create a COS shipping task:

    • Go to the Tencent Cloud - Log Topic page and select the corresponding log storage region in the upper-left corner.

    • Click the target Log Topic name to open its details page.

    • In the left navigation pane, select Shipping to COS, then click Add Shipping Configuration. Configure as follows:

      If the log archival confirmation page appears, click Still Ship To COS.

      • Basic configuration:

        • Shipping time range: To support ongoing data analysis, do not set an end time.

        • Shipping file size: Set the trigger value. When accumulated log size reaches this value, logs are delivered to COS.

        • Shipping interval: Set the delivery interval. Logs from each interval are compressed and shipped to COS.

        Shipping file size and Shipping interval use a logical OR relationship — delivery triggers when either condition is met.

      • Bucket configuration:

        • COS bucket: Select or create a bucket to store logs from Tencent Cloud products such as WAF and Cloud Firewall.

        • File naming: We recommend selecting Delivery time naming for easy data identification.

        • COS path: The storage path for logs in the COS bucket. The default format is /year/month/day/hour/, for example, /2022/7/31/14/. The path supports strftime syntax.

        • File compression: Select gzip or No Compression.

          Security Center does not support lzop or snappy compression for log file parsing.

        • COS storage class: Select Standard storage. For more information, see Storage class overview.

      • Advanced configuration:

        • Consumer data format: Select JSON.

        • JSON: Select Disable Escape.

    • Get the COS bucket endpoint.

      Go to the Tencent Cloud - Bucket List page, locate the COS bucket selected in the previous step. In the bucket details page, copy the domain name from the Domain Information section.

      • The domain must not include the bucket name. The format is: cos.${region}.myqcloud.com.

      • The bucket endpoint is used in subsequent steps.

Set up access keys

  • Main account key: Go to the Tencent Cloud - API Key Management page and click Create Key. Securely store the generated SecretId and SecretKey (click Download CSV File or copy them to a local file). For more information, see Main account access key management.

    You can use either an API key or a project key.

  • Sub-account key:

    • On the Tencent Cloud - Policies page, create a minimum-privilege access policy. For more information, see Shipping to COS authorization and Create custom policy by policy syntax.

      {
          "version": "2.0",
          "statement": [
              {
                  "effect": "allow",
                  "action": [
                      "cls:DescribeTopics",
                      "cls:DescribeLogsets",
                      "cls:DescribeIndex",
                      "cls:CreateShipper"
                  ],
                  "resource": "*"
              },
              {
                  "effect": "allow",
                  "action": [
                      "tag:DescribeResourceTagsByResourceIds",
                      "tag:DescribeTagKeys",
                      "tag:DescribeTagValues",
                      "cls:ModifyShipper",
                      "cls:DescribeShippers",
                      "cls:DeleteShipper",
                      "cls:DescribeShipperTasks",
                      "cls:RetryShipperTask",
                      "cls:DescribeShipperPreview",
                      "cos:GetService",
                      "cam:ListAttachedRolePolicies",
                      "cam:AttachRolePolicy",
                      "cam:CreateRole",
                      "cam:DescribeRoleList"
                  ],
                  "resource": "*"
              }
          ]
      }
    • Go to the Tencent Cloud - User List page. Select an existing sub-account or create a new one.

    • Attach the policy you created.

    • On the User Details page, go to the API Key tab and click Create Key. Securely store the generated SecretId and SecretKey (click Download CSV File or copy them to a local file). For more information, see Sub-account access key management.

Configure COS log import in Alibaba Cloud

Grant Security Center access to COS

    Access the Security Center console - System Settings - Feature Settings. At the top of the left side of the page, select the region where the asset to be protected is located: Chinese Mainland or Outside Chinese Mainland.
  • On the Multi-cloud Configuration Management tab, select Multi-cloud Assets, then click Grant Permission and select IDC from the dropdown. In the panel, configure:

  • Configure synchronization policy

    AK Service Status Check: Set the interval for Security Center to automatically verify Tencent Cloud account access key validity. Select "Disable" to turn off this check.

Create a data import task

    Access the Security Center console - Agentic SOC - Management - Access Settings. At the top of the left side of the page, select the region where the asset to be protected is located: Chinese Mainland or Outside Chinese Mainland.
  • On the Data Import tab, click Add Data. In the panel, configure:

    • Data Source Type: S3.

    • Endpoint: Enter the COS bucket endpoint.

    • Bucket: Enter the COS bucket configured for CLS log shipping.

    • File Path Prefix Filter: Filter S3 files by path prefix to locate the files to import. For example, if the target files are in the csv/ directory, specify the prefix as csv/. For the specific file path, see COS path.

      We strongly recommend setting this parameter. If unset, the system traverses the entire S3 bucket. When the bucket contains a large number of files, full traversal significantly impacts import efficiency.

    • Data Format: The file parsing format.

      • CSV: A separator-delimited text file. You can use the first row as field names or manually specify field names. Each row after the field names is parsed as log field values.

      • JSON: Reads each line of the S3 file as a JSON object. After parsing, each field in the JSON object maps to a log field.

      • Text: Parses each line of the S3 file as one log entry.

      • Multi-line Text: Multi-line mode. Supports specifying a regular expression for the first or last line to parse logs.

      If you select CSV or Multi-line Text, configure the additional parameters described below.

      CSV

      ParameterDescription
      SeparatorSet the log separator. The default value is a comma (,).
      QuoteThe quote character used for CSV strings.
      Escape CharacterSet the log escape character. The default value is a backslash (\).
      Max Line SpanWhen a single log entry spans multiple lines, specify the maximum number of lines. The default value is 10.
      First Row as Header

      Turn on this switch to use the first row of the CSV file as field names. For example, the first row of the following CSV data is extracted as log field names.

      remote_addr,remote_user,time_local,request_time,request_length
      xxx5,-,11/Dec/2020:15:31:06,0,000,133,3650,404,GET
      xxx5,-,11/Dec/2020:15:32:06,0,000,133,3650,404,GET
      xxx5,-,11/Dec/2020:15:34:10,0,000,133,3650,404,GET
      Skip rowsSpecify the number of log rows to skip. For example, set to 1 to start collecting logs from the second row of the CSV file.

      Multi-line Text

      ParameterDescription
      Regex Match Position

      Set the position for regular expression matching:

      • Prefix Regex: Use the regular expression to match the beginning of a log entry. Unmatched lines are part of the current log entry until the maximum line count is reached.

      • Suffix Regex: Use the regular expression to match the end of a log entry. Unmatched lines are part of the next log entry until the maximum line count is reached.

      RegexSet the correct regular expression based on your log content. For information about how to adjust the regular expression, see How do I debug a regular expression?.
      Max LinesThe maximum number of lines per log entry.
    • Compression format: Select the compression format that matches the file compression setting configured in COS.

  • Configure the target data source

    • Data source name: Select a custom data source with normal status (Custom Log Capability / Agentic SOC Dedicated Data Collection Channel). If none exists, see Set up data sources to create one.

    • Target Logstore: Automatically fetched from the selected data source.

    • Click OK to save the configuration. After configuration, Security Center automatically pulls logs from Tencent Cloud.

Analyze imported data

After logs are successfully imported into SLS, configure ingestion rules and detection rules to enable Security Center to analyze these logs.

For example, Tencent Cloud provides predefined standardization rules including Cloud Firewall alert log standardization rule (standardization category: Security Log - Firewall Alert Log) and WAF alert log standardization rule (standardization category: Security Log - Web Application Firewall Alert Log). To create custom rules, click Create Custom Rule on the standardization rule management page.

Billing

This solution involves fees from the following services. Review the billing documentation for each service before implementation to estimate costs.

  • Tencent Cloud:

ServiceFee itemsBilling documentation
Cloud Log Service (CLS)Log storage, read/write fees, and other charges.
Cloud Object Storage (COS)Storage capacity, requests, public network traffic, and other charges.

FAQ

  • No log data appears in SLS after creating the import task.

    • Check Tencent Cloud: Log in to the Tencent Cloud console and confirm that logs have been generated and delivered to the configured CLS, Kafka topic, or COS bucket.

    • Check authorization credentials: On the Multi-cloud Assets page in Security Center, verify the authorization status. Confirm the AccessKey pair is valid and the password uses the correct SecretId#SecretKey concatenated format for Tencent Cloud Kafka.

    • Check network connectivity: If using Kafka, confirm public access is enabled for the Kafka service in Tencent Cloud and that security group or firewall rules allow access from Security Center service IPs.

    • Check the import task: On the Data Import page in Security Center, review the task status and error logs, then make corrections based on the reported information.

  • Why select Apache or AWS-S3 instead of Tencent Cloud when granting permissions?

    Log import uses standard protocol-based connections rather than vendor-specific APIs.

    • Use IDC as the protocol vendor, Apache for Kafka, and AWS-S3 for object storage.

    • The Tencent Cloud authorization option is used only for Agentic SOC threat detection rules to link with Tencent Cloud for security event response (such as IP blocking). It cannot import logs.