.. _envoy_v3_api_file_envoy/config/core/v3/substitution_format_string.proto: Substitution format string ========================== .. _envoy_v3_api_msg_config.core.v3.SubstitutionFormatString: config.core.v3.SubstitutionFormatString --------------------------------------- `[config.core.v3.SubstitutionFormatString proto] `_ Configuration to use multiple :ref:`command operators ` to generate a new string in either plain text or JSON format. .. code-block:: json { "text_format": "...", "json_format": "{...}", "omit_empty_values": "...", "content_type": "..." } .. _envoy_v3_api_field_config.core.v3.SubstitutionFormatString.text_format: text_format (`string `_) Specify a format with command operators to form a text string. Its details is described in :ref:`format string`. For example, setting ``text_format`` like below, .. validated-code-block:: yaml :type-name: envoy.config.core.v3.SubstitutionFormatString text_format: "%LOCAL_REPLY_BODY%:%RESPONSE_CODE%:path=%REQ(:path)%\n" generates plain text similar to: .. code-block:: text upstream connect error:503:path=/foo Precisely one of :ref:`text_format `, :ref:`json_format ` must be set. .. _envoy_v3_api_field_config.core.v3.SubstitutionFormatString.json_format: json_format (`Struct `_) Specify a format with command operators to form a JSON string. Its details is described in :ref:`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. .. validated-code-block:: yaml :type-name: envoy.config.core.v3.SubstitutionFormatString json_format: status: "%RESPONSE_CODE%" message: "%LOCAL_REPLY_BODY%" The following JSON object would be created: .. code-block:: json { "status": 500, "message": "My error message" } Precisely one of :ref:`text_format `, :ref:`json_format ` must be set. .. _envoy_v3_api_field_config.core.v3.SubstitutionFormatString.omit_empty_values: 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. .. _envoy_v3_api_field_config.core.v3.SubstitutionFormatString.content_type: content_type (`string `_) Specify a *content_type* field. If this field is not set then ``text/plain`` is used for *text_format* and ``application/json`` is used for *json_format*. .. validated-code-block:: yaml :type-name: envoy.config.core.v3.SubstitutionFormatString content_type: "text/html; charset=UTF-8"