Using Canvas with essql timestamp of YYYY-MM-DDTHH:MM:SS


I am following this guide to learn how to plot in canvas and i realized that the time used in canvas is in this format: 2019-05-01 00:00:00.
However, when I queried the timestamp from elasticsearch, it is in this format 2019-07-02T18:29:21

Can i use canvas in 2019-07-02T18:29:21 format or i have to convert it in canvas code expression?
If yes, how can i convert it?

This is my attempt and it does not work.

| essql 
  query="SELECT CAST(\"@timestamp\" AS DATETIME) + INTERVAL 8 HOURS AS time, system.memory.actual.used.bytes AS Used, AS Free FROM \"metricbeat-*\" WHERE host.hostname='NUSSERVER' AND system.memory.actual.used.bytes IS NOT NULL AND system.memory.used.bytes IS NOT NULL ORDER BY \"@timestamp\" DESC "
| mapColumn "time" expression={getCell "\"@timestamp\"" | formatdate format="YYYY-MM-DD HH:mm:ss"}
| pointseries x="time" y="mean(Free)" color="mean(Used)"
| plot defaultStyle={seriesStyle lines="1" fill=1 stack="1"} 
  palette={palette "#882E72" "#B178A6" "#D6C1DE" "#1965B0" "#5289C7" "#7BAFDE" "#4EB265" "#90C987" "#CAE0AB" "#F7EE55" "#F6C141" "#F1932D" "#E8601C" "#DC050C" gradient=false}
| render

Thank you.

Found the solution.
Apparently it was quite simple.

| mapColumn time fn={ date | formatdate "YYYY-MM-DD hh:mm:ss" }

Read from here

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