Substitution format string (proto)¶
config.core.v3.SubstitutionFormatString¶
[config.core.v3.SubstitutionFormatString proto]
Configuration to use multiple command operators to generate a new string in either plain text or JSON format.
{
"text_format": ...,
"json_format": {...},
"text_format_source": {...},
"omit_empty_values": ...,
"content_type": ...,
"formatters": []
}
- text_format
(string) Specify a format with command operators to form a text string. Its details is described in format string.
For example, setting
text_format
like below,text_format: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n"
generates plain text similar to:
upstream connect error:503:path=/foo
Deprecated in favor of text_format_source. To migrate text format strings, use the inline_string field.
Precisely one of text_format, json_format, text_format_source must be set.
- json_format
(Struct) Specify a format with command operators to form a JSON string. Its details is described in format dictionary. Values are rendered as strings, numbers, or boolean values as appropriate. Nested JSON objects may be produced by some command operators (e.g. FILTER_STATE or DYNAMIC_METADATA). See the documentation for a specific command operator for details.
json_format: status: "%RESPONSE_CODE%" message: "%LOCAL_REPLY_BODY%"
The following JSON object would be created:
{ "status": 500, "message": "My error message" }
Precisely one of text_format, json_format, text_format_source must be set.
- text_format_source
(config.core.v3.DataSource) Specify a format with command operators to form a text string. Its details is described in format string.
For example, setting
text_format
like below,text_format_source: inline_string: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n"
generates plain text similar to:
upstream connect error:503:path=/foo
Precisely one of text_format, json_format, text_format_source must be set.
- omit_empty_values
(bool) If set to true, when command operators are evaluated to null,
for
text_format
, the output of the empty operator is changed from-
to an empty string, so that empty values are omitted entirely.for
json_format
the keys with null values are omitted in the output structure.
- content_type
(string) Specify a
content_type
field. If this field is not set thentext/plain
is used fortext_format
andapplication/json
is used forjson_format
.content_type: "text/html; charset=UTF-8"
- formatters
(repeated config.core.v3.TypedExtensionConfig) Specifies a collection of Formatter plugins that can be called from the access log configuration. See the formatters extensions documentation for details.
Tip
This extension category has the following known extensions: