google / google/mtail

type inference converts "05" to "5" which then isn't usable in strptime()

Open
#230 10 comments 0 reactions 1 assignee Claimed by @sevaTechoPark View on GitHub
bug mtail-Language/VM
Dominant language
Go
Stars
4k
Forks
392
PR merge metrics
No merged PRs in 30d

Description

```
/^/ +
/(?P\d{4})\/(?P\d{2})\/(?P\d{2}) (?P

hidden gauge time_rfc3339
time_rfc3339 = $year + "-" + $month + "-" + $day + "T" + $time + "Z03:00"
strptime(time_rfc3339, "2006-01-02T15:04:05Z07:00")

error_log_count++
}
```

`error.log`:
```
2019/05/14 11:10:05 [warn] ...
2019/05/14 11:11:06 [warn] ...
```

logfile:
```
I0514 11:13:15.029268 49162 vm.go:90] nginx.mtail: Runtime error: strptime (2006-01-02T15:04:05Z07:00, 2019-5-14T11:11:06Z03:00, UTC) failed: parsing time "2019-5-14T11:13:15Z03:00": month out of range
```

I think mtail transform `05` to `5` because think that it is number.

How can I tell to mtail that I wanna regexp numbers but wanna work with string type?

----

` time_rfc3339 = $year + "-" + string($month) + "-" + $day + "T" + $time + "Z03:00"`
does not help me

`$ mtail -version`
```
mtail version v3.0.0-rc29-12-gc95b546 git revision c95b546631bf7b6077d3377f25aff2d5306d305f go version go1.12.4 go arch amd64 go os freebsd
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.