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

Using --since and -f in combination when using podman logs #14104

Closed
Morgyn opened this issue May 4, 2022 · 15 comments
Closed

Using --since and -f in combination when using podman logs #14104

Morgyn opened this issue May 4, 2022 · 15 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@Morgyn
Copy link

Morgyn commented May 4, 2022

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

Using --since/--tail together with -f when issuing podman logs

Currently when you use both in combination, only since is observed and the log is not followed.

When viewing logs it's handy to get the last few lines before following to get context of the current lines, similar to the GNU tail -n 10 -f command

This combination works with docker, and it was very useful.

Steps to reproduce the issue:

tail -n 10 -f
podman logs --since 1h -f
docker logs --since 1h -f

@openshift-ci openshift-ci bot added the kind/feature Categorizes issue or PR as related to a new feature. label May 4, 2022
@vrothberg
Copy link
Member

Thanks for reaching out, @Morgyn!

Please fill out the entire issue template (e.g., podman info --debug etc.) so we have all the data at hand. Can you share the output of podman info --debug and paste it here? I assume you are using an older version of Podman. I cannot reproduce on v4.0.

@Morgyn
Copy link
Author

Morgyn commented May 4, 2022

podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.23.1
  cgroupControllers:
  - cpuset
  - cpu
  - io
  - memory
  - hugetlb
  - pids
  - misc
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.0-2.fc35.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.0, commit: '
  cpus: 2
  distribution:
    distribution: fedora
    variant: server
    version: "35"
  eventLogger: journald
  hostname: sebbyk
  idMappings:
    gidmap: null
    uidmap: null
  kernel: 5.16.20-200.fc35.x86_64
  linkmode: dynamic
  logDriver: journald
  memFree: 169525248
  memTotal: 10400415744
  ociRuntime:
    name: crun
    package: crun-1.4.4-1.fc35.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 1.4.4
      commit: 6521fcc5806f20f6187eb933f9f45130c86da230
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
  os: linux
  remoteSocket:
    exists: true
    path: /run/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: false
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.12-2.fc35.x86_64
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 8018718720
  swapTotal: 8589930496
  uptime: 6h 49m 7.28s (Approximately 0.25 days)
plugins:
  log:
  - k8s-file
  - none
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /etc/containers/storage.conf
  containerStore:
    number: 2
    paused: 0
    running: 2
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mountopt: nodev,metacopy=on
  graphRoot: /var/lib/containers/storage
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  imageStore:
    number: 2
  runRoot: /run/containers/storage
  volumePath: /var/lib/containers/storage/volumes
version:
  APIVersion: 3.4.7
  Built: 1650546866
  BuiltTime: Thu Apr 21 14:14:26 2022
  GitCommit: ""
  GoVersion: go1.16.15
  OsArch: linux/amd64
  Version: 3.4.7

rpm -q podman: podman-3.4.7-1.fc35.x86_64

podman version:

Version:      3.4.7
API Version:  3.4.7
Go Version:   go1.16.15
Built:        Thu Apr 21 14:14:26 2022
OS/Arch:      linux/amd64

It's 3.4.7 which I believe is the latest released version, obviously something could have changed since the release.

I note that it's mentioned in the podman logs --help as an example:
podman logs --follow=true --since 10m ctrID

But this doesn't work for me, as it performs just the --since part with no --follow

@vrothberg
Copy link
Member

Thanks, @Morgyn. Can you share a reproducer? I cannot reproduce with v3.4.7 either.

@Morgyn
Copy link
Author

Morgyn commented May 4, 2022

# podman run -d --name followtest --rm docker.io/morgyn/followtest
d5468447c7c15391ba416a5d8ab0b140068cd5288699285b46eb4e9a91830091
# podman ps
CONTAINER ID  IMAGE                                   COMMAND               CREATED             STATUS                 PORTS                                               NAMES
d5468447c7c1  docker.io/morgyn/followtest:latest      /start.sh             About a minute ago  Up About a minute ago                                                      followtest
# podman logs -f followtest
Wed May  4 10:59:06 UTC 2022
Wed May  4 11:00:06 UTC 2022
Wed May  4 11:01:06 UTC 2022
^C# podman logs --since 2m followtest
Wed May  4 11:00:06 UTC 2022
Wed May  4 11:01:06 UTC 2022
# podman logs --follow=true --since 2m followtest
Wed May  4 11:00:06 UTC 2022
Wed May  4 11:01:06 UTC 2022
# podman logs -f --since 2m followtest
Wed May  4 11:00:06 UTC 2022
Wed May  4 11:01:06 UTC 2022
# podman logs --since 2m -f followtest
Wed May  4 11:01:06 UTC 2022
Wed May  4 11:02:06 UTC 2022
# 

Note the only one I had to ctrl+c was the one with only follow, all the others terminated after displaying the last 2 mins of logs.

@Morgyn
Copy link
Author

Morgyn commented May 4, 2022

https://github.com/Morgyn/followtest

Is the source of the test container, if you need to check it for some reason

@vrothberg
Copy link
Member

Thanks!

I am still unable to reproduce. Tested Podman v3.4.7 and v4.0.3 and the k8s-file and the journald log driver.

@containers/podman-maintainers can you have a look?

@Luap99
Copy link
Member

Luap99 commented May 4, 2022

I also can not reproduce. I tried latest main with both journald and k8s-file driver.

@Morgyn
Copy link
Author

Morgyn commented May 4, 2022

I've just performed a clean install of fedora 35 + podman 3.4.7 on a new VM and the problem isn't there...

So this appears a unique problem to this install.

@rhatdan rhatdan closed this as completed May 4, 2022
@vrothberg
Copy link
Member

@Morgyn, does the container continue to run after podman logs exited?

@vrothberg vrothberg reopened this May 4, 2022
@rhatdan
Copy link
Member

rhatdan commented May 4, 2022

Reopen if you get it to happen again.

@vrothberg
Copy link
Member

Re-opening as we don't know what's going on.

@Morgyn
Copy link
Author

Morgyn commented May 4, 2022

I have resolved the issue by uninstalling and reinstalling podman with a reboot. I feel an older binary must have been sticking around.

Apologies for wasting peoples time.

@Morgyn Morgyn closed this as completed May 4, 2022
@vrothberg
Copy link
Member

Not at all. Thanks for reaching out!

@p-himik
Copy link

p-himik commented Nov 7, 2022

I can reproduce it on Ubuntu 22.04 with both the default 3.4.7 and the latest 4.3.0, even after removing ~/.local/share/containers.

host:
  arch: amd64
  buildahVersion: 1.28.0
  cgroupControllers:
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon_2:2.1.4-0ubuntu22.04+obs13.12_amd64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.4, commit: '
  cpuUtilization:
    idlePercent: 89.3
    systemPercent: 2.51
    userPercent: 8.19
  cpus: 8
  distribution:
    codename: jammy
    distribution: ubuntu
    version: "22.04"
  eventLogger: journald
  hostname: p-himik-pc
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.15.0-52-generic
  linkmode: dynamic
  logDriver: journald
  memFree: 40550555648
  memTotal: 67367903232
  networkBackend: netavark
  ociRuntime:
    name: crun
    package: crun_1.6-0ubuntu22.04+obs46.9_amd64
    path: /usr/bin/crun
    version: |-
      crun version 1.6
      commit: 18cf2efbb8feb2b2f20e316520e0fd0b6c41ef4d
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /usr/share/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns_1.2.0-0ubuntu22.04+obs10.11_amd64
    version: |-
      slirp4netns version 1.2.0
      commit: 656041d45cfca7a4176f6b7eed9e4fe6c11e8383
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.3
  swapFree: 2147479552
  swapTotal: 2147479552
  uptime: 1h 40m 44.00s (Approximately 0.04 days)
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /home/p-himik/.config/containers/storage.conf
  containerStore:
    number: 4
    paused: 0
    running: 4
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/p-himik/.local/share/containers/storage
  graphRootAllocated: 688065511424
  graphRootUsed: 476395683840
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 4
  runRoot: /run/user/1000/containers
  volumePath: /home/p-himik/.local/share/containers/storage/volumes
version:
  APIVersion: 4.3.0
  Built: 0
  BuiltTime: Thu Jan  1 02:00:00 1970
  GitCommit: ""
  GoVersion: go1.18.1
  Os: linux
  OsArch: linux/amd64
  Version: 4.3.0

@Luap99
Copy link
Member

Luap99 commented Nov 7, 2022

@p-himik Please create a new issue with a reproducer. As mentioned above, we are unable to reproduce.

@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 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

No branches or pull requests

5 participants