Skip to content

Commit

Permalink
Add docs on how to opt-out of complex object parsing (#4184) (#4197)
Browse files Browse the repository at this point in the history
* Add docs on how to opt-out of complex object parsing

* Fix highlighting

(cherry picked from commit d1c3e9e)

Co-authored-by: Carson Ip <[email protected]>
  • Loading branch information
mergify[bot] and carsonip authored Aug 23, 2024
1 parent 5fb85a6 commit 921c996
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions docs/en/observability/apm/configure/env.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ usage in the shell. Arrays at the top-level do not require brackets (`[]`).

For example, the following environment variable is set to a list:

[source,yaml]
[source,bash]
-------------------------------------------------------------------------------
ES_HOSTS="10.45.3.2:9220,10.45.3.1:9230"
-------------------------------------------------------------------------------
Expand All @@ -95,4 +95,27 @@ output.elasticsearch:
When APM Server loads the config file, it resolves the environment variable and
replaces it with the specified list before reading the `hosts` setting.

NOTE: Do not use double-quotes (`"`) to wrap regular expressions, or the backslash (`\`) will be interpreted as an escape character.
[float]
=== Opt-out of complex object parsing

To opt-out of this complex object parsing behavior such that the environment variable
is always parsed as a string, wrap the environment variable in double-quotes (`"`),
and escape all double quotes within them.

For example, given the following config:

[source,yaml]
-------------------------------------------------------------------------------
output.elasticsearch:
password: '${ES_PASSWORD}'
-------------------------------------------------------------------------------

If the intended password is `foo,bar"baz`, to avoid parsing errors due to complex object parsing, the environment variable should be set as follows:

[source,bash]
-------------------------------------------------------------------------------
ES_PASSWORD='"foo,bar\"baz"'
-------------------------------------------------------------------------------


NOTE: Do not use double-quotes (`"`) to wrap regular expressions. Otherwise, the backslash (`\`) will be interpreted as an escape character.

0 comments on commit 921c996

Please sign in to comment.