Hi all,
I'm a newbie to logstash and I'm trying to parse a JSON data file like the following
{
"A001": {
"X": 503744.7,
"Y": 4726339.0,
"Z": 458.84,
"LON": -2.954286956913572,
"LAT": 42.68952475979137,
"dates": [
"2015-01-01",
"2015-01-02",
"2015-01-03",
"2015-01-04",
"2015-01-05",
"2015-01-06"
],
"values": [
"56.9",
"49.7",
"48.1",
"37.1",
"34.4",
"35.9"
]
},
"A002": {
"X": 607870.5,
"Y": 4670754.0,
"Z": 264.83,
"LON": -1.69378623727067,
"LAT": 42.18149989583031,
"dates": [
"2015-01-01",
"2015-01-02",
"2015-01-03",
"2015-01-04"
],
"values": [
"287",
"231",
"207",
"191"
]
},
"A403": {
"X": 868708.0,
"Y": 4709148.0,
"Z": 849.0,
"LON": 1.483146867002623,
"LAT": 42.44694604132231,
"dates": [
"2015-01-01",
"2015-01-02",
"2015-01-03",
"2015-01-04",
"2015-01-05",
"2015-01-06",
"2015-01-07",
"2015-01-08",
"2015-01-09"
],
"values": [
"2.296",
"7.033",
"2.298",
"2.275",
"7.207",
"5.456",
"4.794",
"4.24",
"4.748"
]
}
}
and I'm using the following .conf file
input {
file {
type => "json"
start_position => "beginning"
path => "/etc/logstash/json-data.json"
sincedb_path => "/dev/null" #to force to parse from the beginning
codec => "json_lines"
}
}
filter {
json {
source => "message"
}
}
output {
elasticsearch {
hosts => [ "https://ip:9200" ]
user => "elastic"
password => "mypassword"
ssl_certificate_verification => false
index => "demo-json"
document_type => "json"
}
stdout { codec => rubydebug }
but I'm getting this error:
JSON parse error, original data now in message field {:message=>"incompatible json object type=java.lang.String , only hash map or arrays are supported",
Could you please tell me what I'm doing wrong?
thanks in advance