You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use gogstash to parse logs, and I have some issue parsing time.
I don't have local Go env so I tried the Go Playground and seems like the problem is from Go.
The log I was trying to parse uses "YYYYMMdd-HHmmss-SSS" format for timestamp, so I tried "20060102-150405-999" and "20060102-150405-000" for time format but I got error for both of them.
What did you expect to see?
Time being parsed correctly.
What did you see instead?
parsing time "20180724-101112-111" as "20060102-150405-999": cannot parse "111" as "-999"
The text was updated successfully, but these errors were encountered:
A fractional second is represented by adding a period and zeros to the end of the seconds section of layout string, as in "15:04:05.000" to format a time stamp with millisecond precision.
That is correct. This is working as intended. Please follow #26002 if you want other separators than a period. Or otherwise, change the code to replace - with ..
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?The Go Playground
Code:
https://play.golang.org/p/0oIjit-r3pp
Does this issue reproduce with the latest release?
I guess so?
What operating system and processor architecture are you using (
go env
)?The Go Playground
https://play.golang.org/p/0oIjit-r3pp
What did you do?
I was trying to use gogstash to parse logs, and I have some issue parsing time.
I don't have local Go env so I tried the Go Playground and seems like the problem is from Go.
The log I was trying to parse uses "YYYYMMdd-HHmmss-SSS" format for timestamp, so I tried "20060102-150405-999" and "20060102-150405-000" for time format but I got error for both of them.
What did you expect to see?
Time being parsed correctly.
What did you see instead?
parsing time "20180724-101112-111" as "20060102-150405-999": cannot parse "111" as "-999"
The text was updated successfully, but these errors were encountered: