The problem with this solution is that the difference between timezones is not static, given that DSTs apply at different moments in time.
I was faced with the same problem recently and I solved it by writing the following macro:
[strftime_utc(2)]
args = field, format
definition = "strftime($field$ - (strptime(strftime($field$, \"%Y-%m-%dT%H:%M:%SZ\"), \"%Y-%m-%dT%H:%M:%S%Z\")-strptime(strftime($field$, \"%Y-%m-%dT%H:%M:%S\"), \"%Y-%m-%dT%H:%M:%S\")), \"$format$\")"
iseval = 1
So you can now write a search that looks like this:
index=main | eval utc_time=`strftime_utc(_time, "%Y-%m-%dT%H:%M:%SZ")`
Regardless of what the timezone is on each event, this will cause the output to be in UTC.
Thanks to @richgalloway for the initial suggestion that lead to this.
... View more