Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman-remote logs: --timestamps is a NOP #15797

Closed
edsantiago opened this issue Sep 14, 2022 · 6 comments
Closed

podman-remote logs: --timestamps is a NOP #15797

edsantiago opened this issue Sep 14, 2022 · 6 comments
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote

Comments

@edsantiago
Copy link
Member

Looks like nobody has actually ever tested podman logs --timestamps.

$ bin/podman-remote run --name foo  quay.io/libpod/testimage:20220615 date
Wed Sep 14 12:24:25 UTC 2022
$ bin/podman-remote logs --timestamps foo
Wed Sep 14 12:24:25 UTC 2022

Expected:

2022-09-14T06:24:25.569294000-06:00 Wed Sep 14 12:24:25 UTC 2022
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@edsantiago edsantiago added the remote Problem is in podman-remote label Sep 14, 2022
@github-actions github-actions bot removed the remote Problem is in podman-remote label Sep 14, 2022
@edsantiago edsantiago added the remote Problem is in podman-remote label Sep 14, 2022
@Luap99
Copy link
Member

Luap99 commented Sep 14, 2022

Since you already have a test in your PR feels free to apply this fix so I don't have to create another PR for one line:

diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go
index 324802a1f..572807ad6 100644
--- a/pkg/domain/infra/tunnel/containers.go
+++ b/pkg/domain/infra/tunnel/containers.go
@@ -517,7 +517,7 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string,
        stdout := opts.StdoutWriter != nil
        stderr := opts.StderrWriter != nil
        options := new(containers.LogOptions).WithFollow(opts.Follow).WithSince(since).WithUntil(until).WithStderr(stderr)
-       options.WithStdout(stdout).WithTail(tail)
+       options.WithStdout(stdout).WithTail(tail).WithTimestamps(opts.Timestamps)
 
        var err error
        stdoutCh := make(chan string)

@edsantiago
Copy link
Member Author

Oh, nice, thank you! I will do so, but will wait until #15796 merges.

@edsantiago
Copy link
Member Author

@Luap99 the timestamps I get now are 1-second resolution. With plain podman, I get sub-second:

remote: 2022-09-14T07:01:04          -06:00 hi    (whitespace added to highlight diff; not in original)
normal: 2022-09-14T07:01:04.964164000-06:00 hi

Is this intentional? Is it fixable?

@Luap99
Copy link
Member

Luap99 commented Sep 14, 2022

Is this intentional? Is it fixable?

I have no idea. The timestamp is set on the server so it is part of the API, changing this format could be considered breaking?
Also maybe it is required for docker compat?

frame.WriteString(line.Time.Format(time.RFC3339))

vs
out += fmt.Sprintf("%s ", l.Time.Format(LogTimeFormat))

LogTimeFormat = "2006-01-02T15:04:05.000000000Z07:00"

@Luap99
Copy link
Member

Luap99 commented Sep 14, 2022

@edsantiago
Copy link
Member Author

Fixed in #15794 but the mergebot didn't seem to catch my edit.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 15, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. remote Problem is in podman-remote
Projects
None yet
Development

No branches or pull requests

2 participants