influxdata / influxdata/telegraf
[inputs.socket_listener] source IP address tag
- Dominant language
- Go
- Stars
- 17.8k
- Forks
- 5.8k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 161
Description
### Use Case
I set up `inputs.socket_listener` to receive Graphite metrics from an appliance. Each metric includes the device hostname which I can use as a tag, but unfortunately those hostnames are not very useful. I would like to have the source IP address available as a tag, so these metrics can be correlated with other data sources.
I also saw this requested here for a different use case (syslog): https://community.influxdata.com/t/add-ip-address-tag-to-socket-input/30795/2
### Expected behavior
I would like to add an optional `source` tag with the source IP so the metrics look like this:
```
collectd,host=aragorn,hostname=appliance1,plugin=memory,source=10.37.162.5 percent.used=20.5521696245501 1732310784000000000
```
### Actual behavior
```
collectd,host=aragorn,hostname=appliance1,plugin=memory percent.used=20.5521696245501 1732310784000000000
```
### Additional info
The config I'm using now:
```toml
[[inputs.socket_listener]]
service_address = "tcp://:2004"
data_format = "graphite"
templates = [
"collectd.*.processes.* measurement.hostname.plugin.process.field*",
"collectd.*.cpu.* measurement.hostname.plugin.cpu.field*",
"collectd.*.df.* measurement.hostname.plugin.filesystem.field*",
"collectd.*.interface.* measurement.hostname.plugin.interface.field*",
"measurement.hostname.plugin.field*",
]
```
Contributor guide
Assessment
This issue has not been assessed yet.