${variable_name}, for example, ${RequestHost}. For the list of supported preset fields, see L7 Access Logs.Variable | Description | Example |
${http.request.headers['key']} | The value of the specified header in the client request | ${http.request.headers['user-agent']} |
${http.response.headers['key']} | The value of the specified header in the response from EO to the client | ${http.response.headers['content-type']} |
${http.request.cookie['key']} | The value of the specified field in the client request Cookie | ${http.request.cookie['session_id']} |
${http.request.body} | HTTP request body | ${http.request.body} |
'abc'. Numeric constants can be written directly as 2 or 0.2.\\\\, \\', \\", \\/, \\b, \\f, \\t, \\uHHHH.Category | Operator | Description |
Arithmetic Operators | +,-,*,/ | Both sides must be of numeric type. |
Comparison Operator | <,<=,>,>= | Both sides must be of numeric type. |
Comparison Operator | ==,!= | Both sides must be of numeric type or both be of string type. |
Logical Operator | &&,|| | Can only be used within formula parameters (for example, if). |
Formula Name | Parameters | Description | Example (Input Expression) | Example (Output Value) |
concat | concat(String1, String2, ..., StringN) | Concatenate multiple values into a single string. | concat('Hello, ', 'World', '!') | Hello, World! |
encode_uri | encode_uri(source) | Encodes destructive characters (such as spaces and Chinese characters) in a URI while preserving structural characters :/?.&=#. | encode_uri('https://example.com/search?q=hello world') | https://example.com/search?q=hello%20world |
lower | lower(str) | Converts a string to lowercase. | lower('Hello World') | hello world |
upper | upper(str) | Converts a string to uppercase. | upper('Hello World') | HELLO WORLD |
regexp_replace | regexp_replace(source, regex, replacement) | Performs regular expression replacement | regexp_replace('Chrome/120.0.0', 'Chrome/[0-9.]+', 'Chrome/<ver>') | Chrome/<ver> |
regexp_extract | regexp_extract(expr, pattern[, index]) | Extracts content using regular expressions. Returns the entire matched content when index is 0, and returns the capture group of the corresponding sequence number when it is 1, 2, 3... The default value for index is 0 when index is omitted. | regexp_extract('Chrome/120.0.0', 'Chrome/([0-9.]+)', 1) | 120.0.0 |
if | if(predicate, then, else) | Returns a different value based on a condition. | if(1 < 2, 'yes', 'no') | yes |
cast | cast(expr, type) | Converts the type of a value, where type is LONG, DOUBLE, or STRING | cast(200, 'STRING') | 200 |
timestamp_format | timestamp_format(expr[, pattern[, timezone]]) | Converts a UNIX epoch timestamp in milliseconds to a specified format. The pattern follows the Joda-Time format and defaults to ISO 8601 if not provided. The timezone supports Joda-Time timezone names (such as Asia/Shanghai) or fixed offsets (such as +08:00), and uses UTC by default when omitted. | timestamp_format(1700000000000, 'yyyy-MM-dd HH:mm:ss') | 2023-11-14 22:13:20 |
unix_timestamp | unix_timestamp(timestamp) | Converts an ISO 8601 time string to a UNIX epoch timestamp in seconds. | unix_timestamp('2023-11-14T22:13:20Z') | 1700000000 |
_), and must start with a letter.'a' + ${RequestHost}). Use the concat() formula to perform concatenation.$ triggers preset variable suggestions, while entering a formula name triggers a quick formula search.ClientInfoconcat('host=', ${RequestHost}, ' ip=', ${ClientIP}, ' status=', ${EdgeResponseStatusCode})
"ClientInfo": "host=www.example.com ip=1.2.3.4 status=200"
StatusCategoryif(${EdgeResponseStatusCode}>=200 && ${EdgeResponseStatusCode}<300, 'success', 'error')
if formula by using the >= and < comparison operators combined with the && logical operator."StatusCategory": "success"
"StatusCategory": "error"
Content-Type response header returned by EO to the client.ContentType${http.response.headers['content-type']}
"ContentType": "text/html; charset=utf-8"
ChromeVersionregexp_extract(${http.request.headers['user-agent']}, 'Chrome/([0-9.]+)', 1)
regexp_extract formula is the capture group index, where 1 indicates extracting the content of the first capture group ([0-9.]+)."ChromeVersion": "120.0.0"
RequestTimeFormattedtimestamp_format(unix_timestamp(${RequestTime})*1000, 'yyyy-MM-dd HH:mm:ss', 'Asia/Shanghai')
${RequestTime} is an ISO 8601 format string. It is converted to a second-level timestamp by unix_timestamp(), multiplied by 1000 to obtain the millisecond value, and then formatted for output by timestamp_format(). The third parameter 'Asia/Shanghai' specifies the output time zone as Beijing time. UTC is used by default."RequestTimeFormatted": "2025-08-06 14:30:00"
<custom_field_value> ::= <expr><expr> ::= <term> ("+" | "-" <term>)*<term> ::= <factor> ("*" | "/" | "%" <factor>)*<factor> ::= ("-")? <primary><primary> ::= <num> | <literal_string> | <var> | <func_call> | "(" <expr> ")"<var> ::= "$" "{" <var_name> (<index_key>)? "}"<var_name> ::= [a-zA-Z] ([a-zA-Z0-9] | "_" | ".")*<index_key> ::= "[" <literal_string> "]"<func_call> ::= <func_name> "(" (<func_args>)? ")"<func_name> ::= [a-z] ([a-z] | [0-9] | "_")*<func_args> ::= <func_arg> ("," <func_arg>)*<func_arg> ::= <logic_or><logic_or> ::= <logic_and> ("||" <logic_and>)*<logic_and> ::= <comparison> ("&&" <comparison>)*<comparison> ::= <expr> (<cmp_op> <expr>)?<cmp_op> ::= "==" | "!=" | ">=" | "<=" | ">" | "<"<num> ::= [0-9]+ ("." [0-9]+)?<literal_string> ::= "'" (<ls_plain> | <ls_escape>)* "'"<ls_escape> ::= "\\" ("'" | """ | "\\" | "/" | "b" | "f" | "t" | <unicode_esc>)<unicode_esc> ::= "u" <hex> <hex> <hex> <hex><hex> ::= [0-9] | [a-f] | [A-F]<ls_plain> ::= [a-zA-Z0-9] | " " | "!" | """ | "#" | "$" | "%" | "&" | "("| ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<"| "=" | ">" | "?" | "@" | "[" | "]" | "^" | "_" | "`"| "{" | "|" | "}" | "~"
フィードバック