Hi,
Since yesterday I am trying to work with logstash but I am not able to make much progress.
I have some sentiment data in json which I am trying to read in. If there is a syntax error in the file, or if I use "json" codec for newline delimited file, then I get loads of errors in the stdout. This shows that logstash is at-least trying to read the file.
If I have a single-line json, and I use the codec "json", then I see absolutely nothing. Just some configuration info is printed and the app exits.
Here is my config file:
input {
file {
path => "e:\json_data.json"
codec => "json"
sincedb_path => "NUL"
start_position => "beginning"
}
}
output {
stdout {
codec => "rubydebug"
}
}
Here is the data I want to read-in. I remove all the spaces and turn the file into a non-newline delimited json before passing the data
[
{
"status": "OK",
"docSentiment": {
"score": "-0.831986",
"type": "negative"
},
"language": "english",
"docEmotions": {
"anger": "0.5748",
"joy": "0.046363",
"fear": "0.041051",
"sadness": "0.036716",
"disgust": "0.399636"
}
}
]
For the interested, here's the data in one line:
[{"status":"OK","totalTransactions":"2","docSentiment":{"score":"-0.831986","type":"negative"},"language":"english","docEmotions":{"anger":"0.5748","joy":"0.046363","fear":"0.041051","sadness":"0.036716","disgust":"0.399636"}}]
What I am not able to understand is that using stdin { codec => "json" }
and pasting the data on the console works fine. But redirecting the correct data does nothing. Again, passing the errorneous data throws a lots of errors.
Since I am not using elasticsearch
as the output
, I at least want to see how the data is being parsed by the application.