I have created a line graph in canvas but in the time line I got a wrong timezone with the next SQL query:
SELECT HISTOGRAM("@timestamp", INTERVAL 1 MINUTES) Hora, ip_origen, COUNT(ip_origen) as Cont
FROM autenticacion WHERE "@timestamp" > NOW() - INTERVAL 10 MINUTES
AND ip_origen IS NOT NULL GROUP BY ip_origen, Hora
ORDER BY Hora
I would like to know if there is a way to change the time zone, I have tried including tz="UTC+2" in the expression editor with no luck and I have readed something about moment.js but honestly I dont know what that is and I didnt find any tutorial.
Unfortunately I think this is related to a bug we are tracking where Canvas isn't respecting Kibana settings for time zones. Here's the issue in github:
In the interim while we're working on timezone support in Canvas, you can manually offset the time using this expression:
SELECT HISTOGRAM("@timestamp", INTERVAL 1 MINUTES) Hora, ip_origen, COUNT(ip_origen) as Cont
FROM autenticacion WHERE "@timestamp" > NOW() - INTERVAL 10 MINUTES
AND ip_origen IS NOT NULL GROUP BY ip_origen, Hora
ORDER BY Hora
| mapColumn "Hora" fn={getCell "Hora" | math "value + 1000*60*60*2"}
| alterColumn "Hora" type="date"
I have added 2 hours manually in the SQL query like this:
SELECT HISTOGRAM(pruebafecha + INTERVAL 2 HOURS, INTERVAL 1 MINUTES) AS Hora, ip_origen, COUNT(ip_origen) as Cont
FROM autenticacion WHERE pruebafecha > NOW() - INTERVAL 1 HOURS
AND ip_origen IS NOT NULL GROUP BY ip_origen, Hora
ORDER BY Hora
It works but I dont know if this is the correct way to do it...
Thanks for sharing your solution @dgonzalezp, yeah it looks like you are adding the 2 hours during the SQL query, versus Catherine's example would do it in the expression language. If it works then it works!
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.