secrets-manager icon indicating copy to clipboard operation
secrets-manager copied to clipboard

Log time Issue

Open sahinakyol opened this issue 1 year ago • 1 comments

When I testing commands through cli: There is approximately 61 minutes between log time and my local time(CET) Example: 2024/01/31 15:07:18 [AUDIT] cZPgybnC SecretListRequest {{method:[[GET]],url:... Local time is ~2024/01/31 16:08:18

func AuditLn(correlationId *string, v ...any) { // Audit is always logged. var args []any args = append(args, "[AUDIT]") args = append(args, *correlationId) args = append(args, v...) log.Println(args...) }

func Println(v ...any) { if std.isDiscard.Load() { return } std.Output(2, fmt.Sprintln(v...)) }

func (l *Logger) Output(calldepth int, s string) error { now := time.Now() ... l.formatHeader(&l.buf, now, file, line)

... if l.flag&(Ldate|Ltime|Lmicroseconds) != 0 { if l.flag&LUTC != 0 { t = t.UTC() } ...

Is this a matter that needs to be considered?

sahinakyol avatar Jan 31 '24 18:01 sahinakyol

Not sure. I’ll check and verify if it’s the same in the build server too.

If it’s specific to user’s environment we may ignore it.

But if you can find the root cause @sahinakyol , feel free to create a PR that fixes this.

v0lkan avatar Mar 30 '24 18:03 v0lkan

I don't think there is much we can do here.

log.AuditLn uses the stdlib log package. And the time comes from log module itself.

So, at least it will be consistent across the VSecM instance; and assuming we are using a time server of some sort in a production environment, it will be consistent across the cluster(s) too.

I think go's default log time is UTC; so it is expected to have 1hr delta between CET.

That also means, this is a behavior by design, in a sense :) . The output will always be UTC, and it will be consistent.

Closing this for now.

We might want to revisit it if/when we consider using structured logging (slog).

v0lkan avatar Aug 15 '24 06:08 v0lkan