[inputs.exec] Error in plugin: metric parse error field at 1:44:

Hello Community

I’m trying to parse some metrics collected from syslog through exec plugin, see below telegraf config .

## Commands array
commands = ["bash script.sh"]
data_format = "influx"
timeout = "5s"

cat script.sh

syslog-ng-ctl stats | grep -Ei ".*nginx.*"   | awk -F";" '{ print "syslog,destination="$2,"stats="$5,"value="$6}'

current behavior

Telegraf error :

E! [inputs.exec] Error in plugin: metric parse error: expected field at 1:44:

But when i run the script I got the expected behavior !!

syslog,destination=nginx_srv  stats=truncated_bytes value=0
syslog,destination=nginx_srv stats=eps_since_start value=1548
syslog,destination=nginx_srv  stats=msg_size_max value=1151

Thanks in advance for your help

The output is indeed invalid line protocol. I think you want it like this:

syslog,destination=nginx_srv,stats=truncated_bytes value=0
syslog,destination=nginx_srv,stats=eps_since_start value=1548
syslog,destination=nginx_srv,stats=msg_size_max value=1151

Thanks a lot . That’s work now :wink: