mirror of
https://github.com/elastic/logstash.git
synced 2025-04-23 22:27:21 -04:00
- If no timezone is in the date format, assume localtime and move to UTC time.
This commit is contained in:
parent
6b48e99eaa
commit
c1ecbff37c
1 changed files with 7 additions and 0 deletions
|
@ -96,8 +96,15 @@ module LogStash
|
|||
end
|
||||
end
|
||||
time ||= DateTime.now
|
||||
# Store times in UTC, so subtract
|
||||
res["@DATE"] = time.strftime("%s").to_i
|
||||
|
||||
# Assume local timezone if the date format for this log doesn't
|
||||
# include a timezone offset
|
||||
if !@config[:date_format].include?("%Z")
|
||||
res["@DATE"] -= Time.now.gmtoff
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue