I'm using elasticsearch REST API to add some data to be used in kibana dashboard. I have time stamps in this format 2015-08-04 10:13:14 . This format seems to be incompatible with kibana.
Is there any way to convert it to something like logstash timestamps (2015-08-04T10:13:14.000Z) or any other solution to get kibana work on this?
you can get the exact miliseconds by using:
timestamp=`date +"%Y-%m-%dT%T.%3N"`
As seen in Linux command to get time in milliseconds :
date +"%T.%N"
returns the current time with nanoseconds.
date +"%T.%6N"
returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds.
date +"%T.%3N"
returns the current time with nanoseconds rounded to the first 3 digits, which is milliseconds.
You can use the logstash date
filter to parse timestamps in any format. See the documentation .
Replace with bash one whitespace by T
and append .000Z
:
a="2015-08-04 10:13:14"
b="${a/ /T}.000Z"
echo "$b"
Output:
2015-08-04T10:13:14.000Z
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.