I am setting up some alerts on logs that come from Loki. I can get a timestamp from the log entry. I would like to take that timestamp and use it to create a link to a dashboard with a pre-set time range. This would allow my users who get a logging alert notification to then click the link and see some context around the log entry, instead of just the log entry itself (which by itself is often not very helpful).
I am a newbie and have just started using Grafana Alert notifications. I was also looking for an answer about it, but there was no luck. Anyway, I happened to Google the time package and found a function to convert a date to Unix.
Although my response here is a bit late, I hope someone finds it useful. Please try the ‘Unix’ function from the time package. For example, usage will be like this:
@nyinyitun83, yes, I think I can make that work. Good idea. I was hoping to take the timestamp from a log entry, but those are strings (not time.Time types). Using .StartsAt might just be good enough. Thanks!