fix(iplog): parse xray access-log timestamps in local time
Xray writes access-log timestamps in the server's local timezone, but time.Parse interpreted them as UTC, shifting the stored unix epoch by the host offset. The panel rendered the epoch back to local time, so CST users saw IP-log times 8 hours in the future. Parse the log timestamp with time.ParseInLocation(time.Local) so it round-trips. Fixes #4147
This commit is contained in:
@@ -181,7 +181,7 @@ func (j *CheckClientIpJob) processLogFile() bool {
|
||||
var timestamp int64
|
||||
timestampMatches := timestampRegex.FindStringSubmatch(line)
|
||||
if len(timestampMatches) >= 2 {
|
||||
t, err := time.Parse("2006/01/02 15:04:05", timestampMatches[1])
|
||||
t, err := time.ParseInLocation("2006/01/02 15:04:05", timestampMatches[1], time.Local)
|
||||
if err == nil {
|
||||
timestamp = t.Unix()
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user