I need to add the filed value for my index as current time. like Updated_date column value as current time.
As reference of post :Add field timestamp with current time
we need ruby filter to create a field with the current time.
I am using :
ruby {
code => "event.set('Updated_date',event.get('@timestamp'));
}
but I am getting the result as the timeof data inserted into elasticsearch first time, not after updating the data .
how to create ruby filter to get the current time ?
I have another column in my index as ''amount'' , I am updating the amount value once or a twice a day . so the "Updated_date " column is for getting the last updated time for "amount".
the output of my script is a timestamp : 2017-06-15T09:46:56.415Z
I am just printing the required columns in the output section after updating the amount values:
output{
stdout{
codec => line { format => "%{amount}|%{updated_date}"}
}
elasticsearch{
hosts => ["localhost:9200"]
user => "elastic"
password => "changeme"
index => "thresholds"
document_id => "%{issuer_id}"
doc_as_upsert => "true"
}
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.