podman icon indicating copy to clipboard operation
podman copied to clipboard

podman events --filter machine=... fails with "MACHINE is an invalid filter"

Open HindzStark opened this issue 3 months ago • 2 comments

Issue Description

Machine is a defined event type in Podman representing Podman Machine VM lifecycle events (start, stop, init, remove).

However, attempting to filter the event stream specifically by machine name or VM ID using podman events --filter machine=<vm-name> returns an error: Error: MACHINE is an invalid filter.

Upon checking the codebase:

  • events.Machine ("machine") is explicitly defined in libpod/events/config.go.
  • events.Machine.String() is exposed under --filter type=machine in shell completion (cmd/podman/common/completion.go).
  • However, filtering directly by machine attributes via --filter machine=... fails because generateEventFilter in libpod/events/filters.go lacks a case "MACHINE": handler, and shell autocompletion in cmd/podman/common/completion.go lacks "machine=" mapping.

Steps to reproduce the issue

  1. Initialize or query a podman machine: $ podman machine init
  2. Try to stream events filtered by machine name: $ podman events --filter machine=podman-machine-default
  3. Observe the command failure.

Describe the results you received

Error: MACHINE is an invalid filter

Describe the results you expected

podman events --filter machine=podman-machine-default should filter and display events matching the machine name without throwing an invalid filter error, consistent with --filter container=..., --filter image=..., --filter pod=..., --filter volume=..., --filter secret=..., and --filter network=....

podman info output

host:
  arch: amd64
  buildDaemon: true
  cgroupControllers:
  - cpu
  - io
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.10-1.fc40.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.10, commit: '
  cpus: 8
  distribution:
    distribution: ubuntu
    version: "24.04"
  ociRuntime:
    name: crun
    package: crun-1.14.4-1.fc40.x86_64
    path: /usr/bin/crun
    version: crun version 1.14.4
  os: linux
store:
  configFile: /home/user/.config/containers/storage.conf
  containerStore:
    number: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/user/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /tmp
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  volumeStore:
    number: 0
version:
  APIVersion: 5.0.0
  Built: 0
  BuiltTime: Thu Jan  1 00:00:00 1970
  GitCommit: ""
  GoVersion: go1.22.2
  Os: linux
  OsArch: linux/amd64
  Version: 5.1.0-dev

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

Reproduced on Linux / WSL2 Ubuntu 24.04 environment running upstream development build of Podman.

Additional information

Code references:

  • libpod/events/config.go: Defines Machine Type = "machine".
  • libpod/events/filters.go: generateEventFilter() handles CONTAINER, IMAGE, ARTIFACT, POD, VOLUME, NETWORK, SECRET, TYPE, LABEL, but is missing case "MACHINE":.
  • cmd/podman/common/completion.go: keyValueCompletion is missing "machine=".

HindzStark avatar Aug 12 '26 09:08 HindzStark

machine events are quite different and do not use the libpod event logger otherwise so podman events will never show machine events AFAICT. Therefore it should not accept machine filters.

Luap99 avatar Aug 12 '26 10:08 Luap99

Thanks for clarifying the architectural boundary @Luap99 ! That makes complete sense—since machine events are managed out-of-band and do not write to the libpod event logger, podman events should not accept machine filters.

Closing this issue.

HindzStark avatar Aug 12 '26 10:08 HindzStark