Please help, using [[inputs.socket_listener]]
and [[processors.lookup]]
the expected items did not get inserted tags and values form lookup table file.
- Only guess I have is the separator in the sockets_listener being different? Since coming from Graphite, I put a “_” in there. Does processors.lookup see it as “.” before the separator is replaced.
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
precision = "0s"
debug = true
logtarget = "file"
logfile = "C://Users//myuser//telegrafdebug.txt"
logfile_rotation_max_size = "5MB"
logfile_rotation_max_archives = 5
hostname = ""
omit_hostname = false
[[outputs.file]]
files = ["stdout"]
[[inputs.socket_listener]]
service_address = "udp://0.0.0.0:2012"
data_format = "graphite"
separator = "_"
templates = [
"my.site.*.* measurement.measurement.eqsitesite.field",
"my.site.*.*.* measurement.measurement.eqsitesite.field*",
"my.site.*.*.*.*.max measurement.measurement.eqsitesite.site.field*",
# For health
"my.site.health.* measurement.measurement.field.site",
]
[[processors.lookup]]
files = ["C://Program Files//telegraf//telegraf.d//lut.json"]
format = "csv_key_values"
key = '{{.Tag "site"}}'
Lookup File
lut.json
-,sitename,latitude,longitude
my_site-1,Temp,0.0000,-0.0000
my_site-2,UseThisSiteName,00.7830,-00.3672
stdout.txt
my_site,host=GNSSCUA02,site=2,xrcsite=12 connected_groups_max=4 1702521267000000000
my_site,host=GNSSCUA02,site=2,xrcsite=12 connected_units_max=5 1702522584000000000
debuglog.txt
2023-12-14T03:33:47Z I! Starting Telegraf 1.28.5 brought to you by InfluxData the makers of InfluxDB
2023-12-14T03:33:47Z I! Available plugins: 240 inputs, 9 aggregators, 29 processors, 24 parsers, 59 outputs, 5 secret-stores
2023-12-14T03:33:47Z I! Loaded inputs: cpu disk diskio mem socket_listener swap system
2023-12-14T03:33:47Z I! Loaded aggregators:
2023-12-14T03:33:47Z I! Loaded processors: lookup
2023-12-14T03:33:47Z I! Loaded secretstores:
2023-12-14T03:33:47Z I! Loaded outputs: file influxdb
2023-12-14T03:33:47Z I! Tags enabled: host=GNSSCUA02
2023-12-14T03:33:47Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"GNSSCUA02", Flush Interval:10s
2023-12-14T03:33:47Z D! [agent] Initializing plugins
2023-12-14T03:33:47Z D! [agent] Connecting outputs
2023-12-14T03:33:47Z D! [agent] Attempting connection to [outputs.influxdb]
2023-12-14T03:33:47Z D! [agent] Successfully connected to outputs.influxdb
2023-12-14T03:33:47Z D! [agent] Attempting connection to [outputs.file]
2023-12-14T03:33:47Z D! [agent] Successfully connected to outputs.file
2023-12-14T03:33:47Z D! [agent] Starting service inputs
2023-12-14T03:33:47Z I! [inputs.socket_listener] Listening on udp://[::]:2012
2023-12-14T03:33:57Z D! [outputs.file] Wrote batch of 9 metrics in 2.3082ms
2023-12-14T03:33:57Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2023-12-14T03:33:57Z D! [outputs.influxdb] Wrote batch of 9 metrics in 75.3582ms
2023-12-14T03:33:57Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics
2023-12-14T03:34:07Z D! [outputs.influxdb] Wrote batch of 14 metrics in 4.6123ms
2023-12-14T03:34:07Z D! [outputs.influxdb] Buffer fullness: 0 / 10000 metrics