2020-05-28 05:42:59 +08:00
|
|
|
# Port Name Lookup Processor Plugin
|
|
|
|
|
|
2022-06-07 07:04:28 +08:00
|
|
|
Use the `port_name` processor to convert a tag or field containing a well-known
|
|
|
|
|
port number to the registered service name.
|
2020-05-28 05:42:59 +08:00
|
|
|
|
2022-06-07 07:04:28 +08:00
|
|
|
Tag or field can contain a number ("80") or number and protocol separated by
|
|
|
|
|
slash ("443/tcp"). If protocol is not provided it defaults to tcp but can be
|
|
|
|
|
changed with the default_protocol setting. An additional tag or field can be
|
|
|
|
|
specified for the protocol.
|
2020-10-19 22:49:48 +08:00
|
|
|
|
2022-06-07 07:04:28 +08:00
|
|
|
If the source was found in tag, the service name will be added as a tag. If the
|
|
|
|
|
source was found in a field, the service name will also be a field.
|
2020-05-28 05:42:59 +08:00
|
|
|
|
2020-07-10 02:29:12 +08:00
|
|
|
Telegraf minimum version: Telegraf 1.15.0
|
|
|
|
|
|
2022-10-27 03:58:36 +08:00
|
|
|
## Global configuration options <!-- @/docs/includes/plugin_config.md -->
|
|
|
|
|
|
|
|
|
|
In addition to the plugin-specific configuration settings, plugins support
|
|
|
|
|
additional global and plugin configuration settings. These settings are used to
|
|
|
|
|
modify metrics, tags, and field or create aliases and configure ordering, etc.
|
|
|
|
|
See the [CONFIGURATION.md][CONFIGURATION.md] for more details.
|
|
|
|
|
|
2023-01-12 23:55:21 +08:00
|
|
|
[CONFIGURATION.md]: ../../../docs/CONFIGURATION.md#plugins
|
2022-10-27 03:58:36 +08:00
|
|
|
|
2021-11-25 02:47:11 +08:00
|
|
|
## Configuration
|
2020-05-28 05:42:59 +08:00
|
|
|
|
2022-05-25 22:59:41 +08:00
|
|
|
```toml @sample.conf
|
2022-04-07 04:49:41 +08:00
|
|
|
# Given a tag/field of a TCP or UDP port number, add a tag/field of the service name looked up in the system services file
|
2020-05-28 05:42:59 +08:00
|
|
|
[[processors.port_name]]
|
|
|
|
|
## Name of tag holding the port number
|
|
|
|
|
# tag = "port"
|
2020-10-19 22:49:48 +08:00
|
|
|
## Or name of the field holding the port number
|
|
|
|
|
# field = "port"
|
2020-05-28 05:42:59 +08:00
|
|
|
|
2020-10-19 22:49:48 +08:00
|
|
|
## Name of output tag or field (depending on the source) where service name will be added
|
2020-05-28 05:42:59 +08:00
|
|
|
# dest = "service"
|
|
|
|
|
|
|
|
|
|
## Default tcp or udp
|
|
|
|
|
# default_protocol = "tcp"
|
2020-10-19 22:49:48 +08:00
|
|
|
|
|
|
|
|
## Tag containing the protocol (tcp or udp, case-insensitive)
|
|
|
|
|
# protocol_tag = "proto"
|
|
|
|
|
|
|
|
|
|
## Field containing the protocol (tcp or udp, case-insensitive)
|
|
|
|
|
# protocol_field = "proto"
|
2020-05-28 05:42:59 +08:00
|
|
|
```
|
|
|
|
|
|
2021-11-25 02:47:11 +08:00
|
|
|
## Example
|
2020-05-28 05:42:59 +08:00
|
|
|
|
|
|
|
|
```diff
|
|
|
|
|
- measurement,port=80 field=123 1560540094000000000
|
|
|
|
|
+ measurement,port=80,service=http field=123 1560540094000000000
|
|
|
|
|
```
|