Global Configuration
Access Log Format Configuration
In OpenResty Edge, you can configure multiple access log formats, which are represented in an array.
Parameter Description
Parameter Name | Data Type | Required | Description |
---|---|---|---|
name | string | Yes | The unique identifier name for the access log format |
format | string | Yes | Defines the log format |
escape | string | No | Specifies the escape method for log characters; options include: default, none, json |
default | bool | No | Specifies whether the log format is to be used as the default |
The default
parameter determines whether to set this log format as the default option. If set as default, applications that do not specify a particular log format will use this format.
Note: There can only be one default log format in the configuration.
Configuration Example
access_log_formats:
- default: false
name: example
escape: json
format: |-
{
"time_local": "$time_local",
"method": "$request_method",
"request": "$request",
"transid": "$or_global_user_variable_uuid",
"upstream_header_time": "$upstream_header_time"
}
Following this example configuration, an access log format named example
will be created. The log format list will include both example
and main
formats.
In the format
parameter specified in the log format content, a global user variable named uuid
is represented as $or_global_user_variable_uuid
.
Custom Shared Memory Zone Configuration
You can define multiple shared memory zones; thus, these zones are represented in an array of forms.
Parameter Description
Parameter Name | Data Type | Required | Description |
---|---|---|---|
name | string | Yes | The unique identifier name for the shared memory zone |
size | string | No | Defines the capacity size of the shared memory zone |
size_unit | string | Yes | Specifies the unit of size for the shared memory zone, options are k, m, g |
Configuration Example
custom_shared_zone:
- size_unit: m
name: cache_shared_dict
size: 1
- size_unit: m
name: rec_cache_shared_dict
size: 1
Global Custom Variable Definition
You can define multiple global variables thus the variables are represented in an array form.
Parameter Description
Parameter Name | Data Type | Required | Description |
---|---|---|---|
name | string | Yes | The unique identifier name for the variable |
type | string | Yes | The data type of the variable options include string, num, int, bool |
default | string | Yes | The default value of the variable |
Configuration Example
user_variables:
- name: uuid
type: string
default: '-'
In this example, a global user variable named uuid
is defined. When this variable is needed in access logs or Edgelang scripts, it should be referenced as $or_global_user_variable_uuid
.