Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: Explain --config.expand-env=true double slash with slash substitution #6139

Merged
merged 2 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/sources/clients/promtail/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ ${VAR:default_value}

Where default_value is the value to use if the environment variable is undefined.

**Note**: With `expand-env=true` the configuration will first run through
[envsubst](https://linux.die.net/man/1/envsubst) which will replace double
V-Mann-Nick marked this conversation as resolved.
Show resolved Hide resolved
slashes with single slashes. Because of this every use of a slash `\` needs to
be replaced with a double slash `\\`

### Generic placeholders:

- `<boolean>`: a boolean that can take the values `true` or `false`
Expand Down
10 changes: 10 additions & 0 deletions docs/sources/clients/promtail/stages/regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ But these are not:
- `expression: '\\w*'` (only escape backslashes when using double quotes)
- `expression: "\w*"` (backslash must be escaped)


If you run Promtail with the `--config.expand-env=true` flag the configuration
will run through [envsubst](https://linux.die.net/man/1/envsubst) which will
V-Mann-Nick marked this conversation as resolved.
Show resolved Hide resolved
replace double slashes with single slashes. Because of this when using
`expand-env=true` you need to use double slashes for each single slash. For
example:

- `expression: '\w*'` must be `expression: '\\w*'`
- `expression: "\\w*"` must be `expression: "\\\\w*"`

## Example

### Without `source`
Expand Down