Hello All,
I loaded my csv file via logstash without any problem. I want to convert Low, High, Open , Close from String to Float, and I used mutate and convert in the logstash.conf but when I watch my data on Kibana, it's something look like this below, Low, High, Open and Close are still String, such as "High":163. How to make it as float so that I can do average operation on visualization, thanks for your answer.
JSON format on Kibana:
{
"_index": "bitcoin-prices",
"_type": "logs",
"_id": "AVpymmLhKDtxeN4i7W0P",
"_score": null,
"_source": {
"High": 163,
"Volume (BTC)": "41433.57691",
"Volume (Currency)": "6434985.714",
"Weighted Price": "155.3084767",
"message": "2013-10-16,158.1,163,144.20004,152.83,41433.57691,6434985.714,155.3084767\r",
"Date": "2013-10-16",
"tags": [],
"Open": 158.1,
"path": "/Users/simon/Desktop/simon.csv",
"@timestamp": "2017-02-25T00:10:04.122Z",
"Low": 144.20004,
"@version": "1",
"host": "simons-MacBook-Air.local",
"Close": 152.83
},
"fields": {
"Date": [
1381881600000
],
Here's my logstash.conf:
input {
file {
path => "/Users/simon/Desktop/simon.csv"
start_position => "beginning"
sincedb_path => "/dev/null"
}
}
filter {
csv {
separator => ","
#Date,Open,High,Low,Close,Volume (BTC),Volume (Currency),Weighted Price
columns => ["Date","Open","High","Low","Close","Volume (BTC)", "Volume (Currency)" ,"Weighted Price"]
}
mutate{
convert => {"Low" => "float" }
convert => {"High" => "float"}
convert => {"Open" => "float"}
convert => {"Close" => "float"}
}
}
output {
elasticsearch {
hosts => "http://localhost:9200"
index => "bitcoin-prices"
}