adyanth / cloudflare-operator

A Kubernetes Operator to create and manage Cloudflare Tunnels and DNS records for (HTTP/TCP/UDP*) Service Resources
https://adyanth.site/posts/migration-compose-k8s/cloudflare-tunnel-operator-architecture/
Apache License 2.0
355 stars 37 forks source link

Log timestamps are in 'epoch` format. #87

Closed matthewhembree closed 1 year ago

matthewhembree commented 1 year ago

This is painful to get logging (Grok parsing) setup --in Datadog at least... for me.

It seems that when you use opts.BindFlags, the controller-runtime/zap default of RFC3339TimeEncoder will be changed to epoch. 🤦

Personally, I don't need epoch in cluster. I suppose it might be more useful in local development, so the flag --zap-time-encoding=epoch could be passed to manager.

One could also (even myself) use a Kustomize patch to pass the flag into manager.

Existing:

1.687317215031635e+09   INFO    controller-runtime.metrics      Metrics server is starting to listen    {"addr": ":8080"}
1.687317215032804e+09   INFO    setup   starting manager
1.687317215033797e+09   INFO    Starting server {"path": "/metrics", "kind": "metrics", "addr": "[::]:8080"}
1.687317215033952e+09   INFO    Starting server {"kind": "health probe", "addr": "[::]:8081"}

Proposed:

2023-06-20T22:14:02-05:00       INFO    controller-runtime.metrics      Metrics server is starting to listen    {"addr": ":8080"}
2023-06-20T22:14:02-05:00       INFO    setup   starting manager
2023-06-20T22:14:02-05:00       INFO    Starting server {"path": "/metrics", "kind": "metrics", "addr": "[::]:8080"}
2023-06-20T22:14:02-05:00       INFO    Starting server {"kind": "health probe", "addr": "[::]:8081"}

PR incoming.

Thanks!

adyanth commented 1 year ago

I never noticed the timestamps, good catch!