Parameter | Description | Type | Required | Default Value | Value Range |
alias | Log topic alias | string | Yes | - | - |
waring
, info
, and error
) of the loglevel
field.[{"loglevel": "warning"},{"loglevel": "info"},{"loglevel": "error"}]
// The `loglevel` field has 3 values (`waring`, `info`, and `error`) and therefore the log is distributed to 3 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_split(Field name, sep=",", quote="\\"", jmes="", output="")
Parameter | Description | Type | Required | Default Value | Value Range |
field | Field to extract | string | Yes | - | - |
sep | Separator | string | No | , | Any single character |
quote | Characters that enclose the value | string | No | - | - |
jmes | string | No | - | - | |
output | Name of a single field | string | Yes | - | - |
field
has multiple values{"field": "hello Go,hello Java,hello python","status":"500"}
// Use the separator "," to split the log into 3 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` 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 | Description | Type | Required | Default Value | Value Range |
condition | Function expression whose return value is of bool type | bool | Yes | - | - |
status
is 200
and retain other logs.{"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 | Description | Type | Required | Default Value | Value Range |
condition | Function expression whose return value is of bool type | bool | Yes | - | - |
status
is 500
and delete other logs.{"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 | Description | Type | Required | Default Value | Value Range |
field | Field to extract | 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?