How convert timestamp in date


(Kevin S) #1

Hello,Im new user for logstash and i need help .
i want use 'timestamp' column in my csv but its not work .
If you can help me .
Thanks

input {
file{
path =>"/Users/itsgood/Desktop/money/coins_btc.csv"
start_position =>beginning
sincedb_path=>"dev/null"
}
file{
path =>"/Users/itsgood/Desktop/money/coins_etc.csv"
start_position =>beginning
sincedb_path=>"dev/null"
}
}
filter{
csv{
separator => ";"
columns =>
["price_btc","volume_24h_btc","market_cap_btc","percent_change_1h_btc","percent_change_24h_btc","percent_change_7d_btc","timestamp_btc","price_eth","volume_24h_eth","market_cap_eth","percent_change_1h_eth",
"percent_change_24h_eth","percent_change_7d_eth",
timestamp_eth"]
}
date {
match => [ "timestamp","MMM-dd-yyyy HH:mm:ss" ]
target => "timestamp_btc"
}

}
output {
stdout { codec => rubydebug }
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "csv_index"
}
}


(Magnus Bäck) #2

match => [ "timestamp","MMM-dd-yyyy HH:mm:ss" ]

This tells the date filter to parse the timestamp field. AFAICT you don't have a field by that name. Did you mean timestamp_btc?


(Kevin S) #3

I test that but ,its not work .
My timestamp = 1527433633


(Magnus Bäck) #4

Okay, but that's not a timestamp in MMM-dd-yyyy HH:mm:ss format. Try UNIX instead.


(Kevin S) #5

Its good now,thanks you very much .you save me


(system) #6

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.