I am relatively new to grafana and as a visualization tool, it's been fantastic. The major issue I have is I have some pretty legacy systems that log based on the server's time (which is always in Eastern time) From what I have noticed, grafana is always expecting the data source time to be UTC.
Is there a way to get the timezone of a data source in eastern time for a Microsoft SQL Server data source? Or potentially a plugin that could do the conversion? Or is my only option code like this in every query
dateadd(hour, datediff(hour, getdate(), getutcdate()), l.date) as date,
CodePudding user response:
There is no way to apply a specific timezone/offset by DataSource in Grafana. In Grafana it can be managed as a Server/Org/user setting, by default it uses the timezone in your web browser which I think works fine in most use cases.
Your workaround works fine and the only other option I'm aware of is to use the AT TIME ZONE, which does not solve the fact that you will have to put it more or less everywhere.
The only way I see to centralize the timezone conversions is to create a view (or maybe a function) that handles the conversion, therefore standardizing the timezone of those legacy systems. If possible I'd go for the view as it is the most transparent solution I can think of.