0

I've tried everything I could and still can't make it work.

I'm using the time key in Ops agent, and the time needs to be parsed is '2023-06-30T07:42:10.103467+00:00'

I've tried many different time string format and it always shows the error as follows:

[2023/06/30 07:47:49] [error] [parser] cannot parse '2023-06-30T07:47:49.637160+00:00'
[2023/06/30 07:47:49] [ warn] [parser:default_pipeline.fortvax_stage.0] invalid time format %Y-%m-%dT%H:%M:%S.%6N+%H:%M for '2023-06-30T07:47:49.637160+00:00'

Anyone could help me to get it work will be so much appreciated.

Ray
  • 333
  • 4
  • 11
  • 1
    `time_format` is [based on `strptime`](https://cloud.google.com/monitoring/agent/ops-agent/configuration#logging-processor-parse-json), so: 1) use `%L` for the fractional seconds, and 2) use `%z` instead of repeating `%H` and `%M` for the time zone. In other words, `%Y-%m-%dT%H:%M:%S.%L%z`. – Jeff Jul 01 '23 at 21:09
  • It worked. You saved my day. – Ray Jul 02 '23 at 22:13
  • @Jeff By the way, I didn't find `%L` definition in the [strptime link provided](https://linux.die.net/man/3/strptime), where did you find it? – Ray Jul 02 '23 at 22:16

0 Answers0