
log_output (Alias)

Parameter Name | Parameter Description | Parameter Type | Required | Default Value | Parameter Value Range |
alias | Alias name of the target topic | string | Yes | - | - |
[{"loglevel": "warning"},{"loglevel": "info"},{"loglevel": "error"}]
//The loglevel field has three values including waring, info, and error, and therefore the log is distributed to three different log topics accordingly.t_switch(regex_match(v("loglevel"),regex="info"),log_output("info_log"),regex_match(v("loglevel"),regex="warning"),log_output("warning_log"),regex_match(v("loglevel"),regex="error"),log_output("error_log"))

log_auto_output(topic_name="", logset_name="", index_options="", period=3,storage_type=" ",hot_period=0)
Parameter Name | Parameter Description | Parameter Type | Required | Parameter Default Value | Description |
topic_name | Log Topic Name | string | y | - | If the parameter `topic_name` contains a vertical bar ("|"), the vertical bar is removed from the generated topic name. If the length of the parameter `topic_name` exceeds 250 characters, the generated log topic name contains only the first 250 characters, and any excess characters are truncated. |
logset_name | Logset Name | string | y | - | - |
index_options | all_index: Enables key-value and full-text indexing. no_index: Does not enable indexing. content_index: Enables full-text indexing. key_index: Enables key-value indexing. | string | n | all_index | If storage_type=cold (that is, STANDARD_IA storage), then all_index and key_index do not take effect, meaning STANDARD_IA storage does not support key-value indexing. |
period | Storage period, typically ranging from 1 - 3600 days 3640 indicates permanent storage. | number | n | 3 | 1 - 3600 days. |
storage_type | Storage type of the log topic, with optional values hot: STANDARD storage cold: STANDARD_IA storage | string | n | hot | When the value is cold, the minimum value for period is 7 days. |
hot_period | 0: Disable log archiving Non-zero: The number of days for STANDARD storage after log archiving is enabled. HotPeriod must be greater than or equal to 7 and less than Period, and this rule only takes effect when StorageType is hot. | number | n | 0 | - |
tag_dynamic | Adds dynamic Tags to a log topic. It works with the extract_tag() function to extract Tag key-value pairs from log fields. For example: tag_dynamic=extract_tag(v("pd"),v("env"),v("team"), v("person")). | string | n | - | The total number of Tags for tag_dynamic and tag_static combined must not exceed 10 pairs. |
tag_static | Adds static Tags to a log topic. For example: tag_static="Ckafka:test_env,developer_team:MikeWang". | string | n | - | Example of not exceeding 10 pairs of Tags in combination with tag_dynamic. |
[{"pd": "CLB","dateTime": "2023-05-25T00:00:26.579"},{"pd": "Ckafka","time": "2023-05-25T18:00:55.350+08:00"},{"pd": "COS","time": "2023-05-25T00:06:20.314+08:00"},{"pd": "CDN","time": "2023-05-25T00:03:52.051+08:00"}]
log_auto_output(v("pd"), "My Logset", index_options="content_index", period=3)

Special Scenario | How It Works |
If the parameter topic_name fails to be obtained or is "" (empty string), the log entry will go to the log topic named "null". | For example, if the app field is specified as topicname (that is, the log topic name), but a log entry does not contain the app field or its value is " ", then the log entry will be written to the log topic named "null". The logset to which the "null" topic belongs is the logset specified in the logset parameter of this function. Note: If you use string concatenation to specify a log topic name, for example log_auto_output( str_join("-", "myPrefix", v("app")), "myLogSet",period=14,storage_type="hot",hot_period=10), then when the app does not exist or its value is " ", logs are written to the log topic named "myprefix". |
Duplicate topic name (within the same logset) | If a log topic named "Nginx" already exists, when the dynamic creation task, according to the rules, also needs to create a log topic named "Nginx", it will add the CreateByCLSETL suffix, and the created log topic will be named "Nginx-CreateByETL". |
Special Scenario | How It Works |
Duplicate logset name (within the same region) | If you manually create a logset named "myLogSet" and a dynamically created task also needs to create a logset named "myLogSet" according to the function rules, the suffix "CreateByCLSETL" is automatically appended. If Auto-Create Task 1 creates a logset named "myLogSet", and Auto-Create Task 2 also defines a logset name as "myLogSet", then Auto-Create Task 2 uses the same logset name "myLogSet" as the target logset. This means a new logset with the suffix "CreateByCLSETL" is not automatically created. |
Special Scenario | How It Works |
Failure to Obtain KV Values of Dynamic Tags. | For example, if field A is specified as the Tag Key and field B as the Tag Value, but a log entry lacks field A or field B, or the values of fields A and B are left empty, the Tag addition fails. |
Leading or Trailing Spaces in Tag KV Values. | Tag addition fails. |
Total Number of Dynamic and Static Tags Exceeds 10 Pairs. | Dynamic Tags have higher priority. If the total number is still less than 10 pairs after Dynamic Tags are added, Static Tags are supplemented, but the total number does not exceed 10 pairs. |
Tag KV Length Exceeds Limit. | If the Tag key length exceeds 127 or the value length exceeds 255, the Tag addition fails. |
log_split(field name, sep=",", quote="\\", jmes="", output="")
Parameter Name | Parameter Description | Parameter Type | Required | Default Value | Parameter Value Range |
field | Field name to be extracted. | string | Yes | - | - |
sep | Delimiter | string | No | , | Any single character. |
quote | Character that includes the value. | string | No | - | - |
jmes | Note: If the jmes contains special characters, such as . \\ * + ? ^ $ | () [] {} - /, you must add an escape character. | string | No | - | - |
output | Single field name. | string | Yes | - | - |
{"field": "hello Go,hello Java,hello python","status":"500"}
//Use the delimiter ",", to split the log into three logs.log_split("field", sep=",", output="new_field")
{"new_field":"hello Go","status":"500"}{"new_field":"hello Java","status":"500"}{"new_field":"hello python","status":"500"}
{"field": "{\\"a\\":{\\"b\\":{\\"c\\":{\\"d\\":\\"a,b,c\\"}}}}", "status": "500"}
//The value of a.b.c.d node is "a, b, c".log_split("field", jmes="a.b.c.d", output="new_field")
{"new_field":"a","status":"500"}{"new_field":"b","status":"500"}{"new_field":"c","status":"500"}
{"field": "{\\"a\\":{\\"b\\":{\\"c\\":{\\"d\\":[\\"a\\",\\"b\\",\\"c\\"]}}}}", "status": "500"}
log_split("field", jmes="a.b.c.d", output="new_field")
{"new_field":"a","status":"500"}{"new_field":"b","status":"500"}{"new_field":"c","status":"500"}
log_drop (condition 1)
Parameter Name | Parameter Description | Parameter Type | Required | Default Value | Parameter Value Range |
condition | A function expression whose value is of the bool type | bool | Yes | - | - |
[{"field": "a,b,c","status": "500"},{"field": "a,b,c","status": "200"}]
log_drop(op_eq(v("status"), 200))
{"field":"a,b,c","status":"500"}
log_keep (condition 1)
Parameter Name | Parameter Description | Parameter Type | Required | Default Value | Parameter Value Range |
condition | A function expression whose value is of the bool type | bool | Yes | - | - |
[{"field": "a,b,c","status": "500"},{"field": "a,b,c","status": "200"}]
log_keep(op_eq(v("status"), 500))
{"field":"a,b,c","status":"500"}
log_split_jsonarray_jmes("field", jmes="items", prefix="")
Parameter Name | Parameter Description | Parameter Type | Required | Default Value | Parameter Value Range |
field | Field name to be extracted. | string | Yes | - | - |
{"common":"common","result":"{\\"target\\":[{\\"a\\":\\"a\\"},{\\"b\\":\\"b\\"}]}"}
log_split_jsonarray_jmes("result",jmes="target")fields_drop("result")
{"common":"common", "a":"a"}{"common":"common", "b":"b"}
{"common":"common","target":"[{\\"a\\":\\"a\\"},{\\"b\\":\\"b\\"}]"}
log_split_jsonarray_jmes("target",prefix="prefix_")fields_drop("target")
{"prefix_a":"a", "common":"common"}{"prefix_b":"b", "common":"common"}
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback