Cloud Threat Detection and Response (CTDR) allows you to ingest logs from security vendors into the Security Center console for unified risk management. A parsing function is a specific rule used to standardize the fields from collected security vendor logs, which are stored in a dedicated CTDR Logstore. This document describes the parsing functions in CTDR to help you configure log parsing rules.
Types of parsing functions
Type | Description |
direct mapping | Maps the value of an original field directly to a target field without any changes. For example, the value of Field A is mapped directly to Field B. |
constant mapping | Assigns a fixed, constant value to a target field. This is useful when no corresponding original field exists. For example, the string "abc" is assigned to Field B. |
dictionary mapping | Maps values from a specific log field to standard CTDR field values by using a predefined dictionary. For example, the standard CTDR field
After you configure the dictionary mapping, CTDR standardizes the alert levels from the security vendor logs. |
function mapping | Processes a value from an original field by using a function and then maps the result to a target field. |
Supported functions
Function | Syntax | Description | Parameters | Example |
JSON_VALUE |
| Extracts data from a JSON object. Supports nested paths. |
| JSON_VALUE(json, '$.passenger_name') |
LOWER |
| Converts a string to lowercase. |
| LOWER(var1) |
UPPER |
| Converts a string to uppercase. |
| UPPER(var1) |
SUBSTRING |
| Extracts a substring starting at the specified |
|
|
KEYVALUE |
| Parses a string
The function retrieves the value corresponding to the specified |
| KEYVALUE(str, ';', ':', 'key1') |
REGEXP_EXTRACT |
| Extracts a substring from |
Note This function uses Java's regular expression engine. Therefore, you must write patterns according to Java syntax. For example, if you want to match a digit, in SQL, you should write This ensures the expression is correctly compiled. For more information, see the Java Pattern documentation. | REGEXP_EXTRACT(str1, 'foo(.*?)(bar)', 1) |
DATE_FORMAT |
| Formats a
|
| DATE_FORMAT(datetime1, 'yyMMdd') |
FROM_UNIXTIME | FROM_UNIXTIME(BIGINT unixtime, VARCHAR format) | Converts a Unix timestamp to a formatted date string. The function accepts two parameters:
The function returns a VARCHAR string that represents the date and time. Returns |
| FROM_UNIXTIME(unixtime1, 'MMdd-yyyy') |
UNIX_TIMESTAMP | UNIX_TIMESTAMP(VARCHAR date, VARCHAR format) | Converts a date string to a Unix timestamp in seconds. It accepts two optional parameters:
The function returns a long integer timestamp in seconds. If called with no arguments, this function returns the current timestamp, which is equivalent to the |
| UNIX_TIMESTAMP('2024-11-19', 'yyyy-MM-dd') |
SPLIT_INDEX | SPLIT_INDEX(str, sep, index) | Splits the string |
| SPLIT_INDEX('a,b,c', ',', 0) |
CONCAT | CONCAT(string1, string2, ...) | Concatenates two or more |
| CONCAT(var1, '-', var2) |
REGEXP_REPLACE | REGEXP_REPLACE( str, pattern, replacement) | Replaces all substrings in |
Note This function uses Java's regular expression engine. Therefore, you must write patterns according to Java syntax. For example, if you want to match a digit, in SQL, you should write This ensures the expression is correctly compiled. For more information, see the Java Pattern documentation. | REGEXP_REPLACE(str1, '(\d+)', '') |
Manage mapping dictionaries
Add a mapping dictionary
Log on to the Security Center console.
In the left-side navigation pane, choose . In the upper-left corner, select the region where your assets are located: Chinese Mainland or Outside Chinese Mainland.
On the Service Integration page, click Log Parsing Rule in the upper-right corner.
On the Log Parsing Rule page, click Manage Mapping Dictionary in the upper-right corner.
In the Manage Mapping Dictionary panel, click Add Dictionary.
In the Add Mapping Dictionary panel, configure the parameters and click OK.
Parameter
Description
Dictionary Name
Enter a name for the dictionary.
Target Standard Field
Select the standard target field to which the dictionary applies.
Remarks
Enter remarks for the dictionary.
Configure Mappings
Set the mapping between original field values and target field values. You can click Add Mapping to add multiple mappings.
Edit a mapping dictionary
Editing a mapping dictionary does not affect existing rules that use it. Changes take effect only after you modify and save a rule, which causes it to fetch the latest dictionary version.
Log on to the Security Center console.
In the left-side navigation pane, choose . In the upper-left corner, select the region where your assets are located: Chinese Mainland or Outside Chinese Mainland.
On the Service Integration page, click Log Parsing Rule in the upper-right corner.
On the Log Parsing Rule page, click Manage Mapping Dictionary in the upper-right corner.
In the Actions column of the target dictionary, click Edit.
In the Edit Mapping Dictionary panel, update the dictionary content and click OK.
Delete a mapping dictionary
Deleting a mapping dictionary does not affect existing rules that already use it.
Log on to the Security Center console.
In the left-side navigation pane, choose . In the upper-left corner, select the region where your assets are located: Chinese Mainland or Outside Chinese Mainland.
On the Service Integration page, click Log Parsing Rule in the upper-right corner.
On the Log Parsing Rule page, click Manage Mapping Dictionary in the upper-right corner.
In the Actions column of the target dictionary, click Delete.
In the Delete Confirmation dialog box, click OK.