I'm trying to determine if there is a way within a Logstash conf file to correct an invalid JSON field being passed in? Here is the data:
{ "trace": "ID-in":"83455E37DD688327", "ID-out":"83455E37DD688327", "reply-to-in":"l.metx.metx+1003.cosma", "route-in":"b.metx.cosma", "route-out":"b.metx.cosma", "time-in":"1747938599239", "time-out":"1747938599239", "class-in":"0", "class-out":"0", "from":"TQ.wifi", "to":"TNB.Inbound.Ex", "latency":"8", "handling-time":"0", "transport-used":"wifi", "sh-code-in":"0", "sh-code-out":"0", "emp-msg-id":"6010" }
The 3rd party application is also sending out correct data:
{ "name":"trace", "ID-in":"50AF7506625A625", "ID-out":"294E131FAB4A5684", "crc-out":"64657", "fpid":"-", "reply-to-in":"l.metx.metx+1003.cosma", "route-in":"b.metx.cosma", "route-out":"b.metx.cosma", "time-in":"1747938669306", "time-out":"1747938669306", "size-in":"157", "size-out":"118", "class-in":"0", "class-out":"0", "from":"metx.l.metx.1003.CosmaApp.FromApplication", "to":"RBOutbound.Ex", "latency":"0", "handling":"0", "transport-used":"-", "emp-msg-id":"6010" }
Which I am able to parse like so:
grok {
match => {
"message" => '%{SYSLOGTIMESTAMP:tmc_timestamp} %{SYSLOGHOST:tmc_hostname} %{DATA:tmc_program}\[%{POSINT:tmc_app_pid}\]: .*? %{TIMESTAMP_ISO8601:ruby_timestamp} %{DATA:tmc_unit} %{DATA:tmc_svcname} .*? \[.*?="%{IP:itcm_major}%{DATA:itcm_minor}\"\].*?%{GREEDYDATA:tmc_json}'
}
}
Right now, I'm tossing away this invalid data due to this invalid section: "trace":. I'd like to change it to: "name":"trace",. I would be greatly appreciative of any suggestions on this dilemma.
Regards,
Marc M.