Target: replace¶
| Plugin name | target_replace |
| Status | supported |
| Since | 4.6 |
| Copyright | 2008 Florian octo Forster |
| License | GPLv2 |
| Configuration | collectd.conf(5) |
Description¶
The Replace target uses regular expressions to substitute parts of an identifier with another string. It is similar to the s/// command known from sed(1) and Perl. This plugin is using the extended POSIX flavor of regular expressions, see regex(7).
Synopsis¶
Please note that backslashes need to be escaped in the configuration.
<Target "replace">
# Replace "example.net" with "example.com"
Host "\\<example.net\\>" "example.com"
# Strip "www." from hostnames
Host "\\<www\\." ""
</Target>
Dependencies¶
- none
Configuration¶
Configuration options · from collectd.conf(5)
See this section in the full configuration reference
Replaces parts of the identifier using regular expressions.
Available options:
- Host Regex Replacement
- Plugin Regex Replacement
- PluginInstance Regex Replacement
- TypeInstance Regex Replacement
- MetaData String Regex Replacement
- DeleteMetaData String Regex
-
Match the appropriate field with the given regular expression Regex. If the regular expression matches, that part that matches is replaced with Replacement. If multiple places of the input buffer match a given regular expression, only the first occurrence will be replaced.
You can specify each option multiple times to use multiple regular expressions one after another.
Example: