Skip to content

feat: label-based filtering added to nerdctl events#4999

Open
Mujib-Ahasan wants to merge 2 commits into
containerd:mainfrom
Mujib-Ahasan:label-based-filtering
Open

feat: label-based filtering added to nerdctl events#4999
Mujib-Ahasan wants to merge 2 commits into
containerd:mainfrom
Mujib-Ahasan:label-based-filtering

Conversation

@Mujib-Ahasan

@Mujib-Ahasan Mujib-Ahasan commented Jun 23, 2026

Copy link
Copy Markdown

Description

This PR adds support for label-based filtering in nerdctl events. Users can now filter the event stream using container labels, for example:

nerdctl events --filter label=com.example.app=myapp

Fixes: #4690

The implementation resolves container metadata from incoming events and matches the configured label filter before displaying the event. This helps users focus on events related to a specific workload in environments with so many running containers.

  • I have tested this out in my local machine before pushing it.

Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>
Comment thread pkg/cmd/system/events.go Outdated

eOut := EventOut{e.Timestamp, id, e.Namespace, e.Topic, TopicToStatus(e.Topic), string(out)}
if id != "" {
container, err := client.ContainerService().Get(ctx, id)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably can improve like


if container, err := client.ConatinerService.Get(ctx, id); err == nil {
    labels = container.Labels
}

Comment thread pkg/cmd/system/events.go

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Mujib Ahasan <ahasanmujib8@gmail.com>
@Mujib-Ahasan Mujib-Ahasan requested a review from AkihiroSuda June 25, 2026 11:01
@Mujib-Ahasan

Copy link
Copy Markdown
Author

@AkihiroSuda there are so many failed checks and after surfacing little bit I strongly feels they are flaky and not related to the changes in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support --since, --until, and label filtering in nerdctl events

3 participants