Hello,
I am struggling to obtain fields with values from simple JSON file using logstash.
Currently putting the output to file so I see if it looks okay, but I always receive errors for each line.
JSON :
{
"cpuLoad": {
"minute1": 1.7300000190734864,
"minute5": 1.149999976158142,
"minute15": 0.9800000190734864
},
"memory": {
"usage": 48,
"free": 3598,
"total": 6980,
"used": 3382
},
"uptime": 3608527,
"time": "Wed Nov 11 08:32:36 2020",
"model": "vfc4",
"release": "GWAY-7.2.4-0186",
"serialNumber": "1036380",
"cpuCores": 2,
"hostname": "Hostname1",
"users": 0,
"appliance": "VM",
"hypervisor": "MSHV"
}
Logstash config:
input {
file {
path => "/opt/logstash/fw-status.json"
start_position => "beginning"
}
}
filter {
json {
source => "message"
}
}
output {
file {
path => "/tmp/parsed.log"
}
}
Errors from Logstash:
[2020-11-11T08:42:46,244][WARN ][logstash.filters.json ][main][937092775ddd949f8f84f6a46203fd34db422fad527a0c49c2a8a0bc1a50d8d3] Error parsing json {:source=>"message", :raw=>" },", :exception=>#<LogStash::Json::ParserError: Unexpected close marker '}': expected ']' (for root starting at [Source: (byte[])" },"; line: 1, column: 0])
at [Source: (byte[])" },"; line: 1, column: 4]>}
[2020-11-11T08:42:46,278][WARN ][logstash.filters.json ][main][937092775ddd949f8f84f6a46203fd34db422fad527a0c49c2a8a0bc1a50d8d3] Error parsing json {:source=>"message", :raw=>" \"appliance\": \"VM\",", :exception=>#<LogStash::Json::ParserError: Unexpected character (':' (code 58)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: (byte[])" "appliance": "VM","; line: 1, column: 15]>}
I am receiving above error messages for every line of JSON. Tried also the most simple json with 2 lines, with same result.
Is there any mistake in the configuration file?
Thank you in advance for helping.
Stefan