Closed hedhyw closed 9 months ago
Resolving this would also resolve https://github.com/hedhyw/json-log-viewer/issues/7 correct?
Is it expected that the time column is always encoded as a string, or is possible that the raw JSON might be like:
[{
"time": 1234.2
}]
Is it expected that the time column is always encoded as a string, or is possible that the raw JSON might be like:
It can be:
[{
"time": 1234.2
}, {
"time": 1234
}, {
"time": "1234"
}]
but actually, it is not a big problem since we have a string as an input: https://github.com/hedhyw/json-log-viewer/blob/c8ce24a6c88470870215aca60808c76124cc57ea/internal/pkg/source/entry.go#L103
but actually, it is not a big problem since we have a string as an input:
Thanks for the feedback.
There actually looks to be an issue calling strconv.Unquote() if the value is a non-string. My proposal for how to work around this is included in the PR I'm working on. https://github.com/hedhyw/json-log-viewer/pull/38/files#diff-fe24c90fd92a660740201af245c3d85f0751d5b998634662896e0a2762eb7848R84-R88
Add new kinds:
FieldKind=numerictime
, timestamp with auto-determination of type (seconds, milli, micro, etc., by the number of digits), use it by default.FieldKind=millitime
- timestamp in Unix milliseconds.FieldKind=sectime
- timestamp in Unix seconds.FieldKind=microtime
- timestamp in Unix microseconds.If the value is a number then convert it to a string (
RFC3339
), otherwise show it as is. Support float.