Skip to content

feat: add --details flag to logs command #4009

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

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

SpiffyEight77
Copy link
Contributor

@SpiffyEight77 SpiffyEight77 commented Mar 16, 2025

Description

Implements the --details flag for nerdctl logs to display log options(env and labels) as a prefix to each log line.

Test

json-file

nerdctl run -d \
  --name json-file-details \
  --log-driver json-file \
  --log-opt env=foo \
  --log-opt env=os,customer \
  --log-opt labels=production_status,geo \
  --log-opt labels=bar \
  --label geo=GEO \
  --env customer=CUSTOMER \
  --env os=OS \
  --label bar=BAR \
  --env foo=FOO \
  busybox sh -c "echo 'This is a test message'"

nerdctl logs --details json-file-details
bar=BAR,customer=CUSTOMER,os=OS This is a test message

journald

nerdctl run -d \
  --name journald-details \
  --log-driver json-file \
  --log-opt env=foo \
  --log-opt env=os,customer \
  --log-opt labels=production_status,geo \
  --log-opt labels=bar \
  --label geo=GEO \
  --env customer=CUSTOMER \
  --env os=OS \
  --label bar=BAR \
  --env foo=FOO \
  busybox sh -c "echo 'This is a test message'"

nerdctl logs --details journald-details
bar=BAR,customer=CUSTOMER,os=OS This is a test message

@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch 7 times, most recently from 7e376fb to a9f9961 Compare March 19, 2025 10:18
@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch 2 times, most recently from adf61cf to 4322307 Compare April 12, 2025 09:48
@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch 2 times, most recently from d19c308 to f39dbe8 Compare April 13, 2025 07:00
@SpiffyEight77 SpiffyEight77 marked this pull request as ready for review April 13, 2025 07:01
@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch from f39dbe8 to ffe9806 Compare April 13, 2025 07:07
@AkihiroSuda AkihiroSuda added this to the v2.0.5 milestone Apr 19, 2025
@AkihiroSuda AkihiroSuda requested a review from fahedouch April 19, 2025 14:05
@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch from d596d3d to a309b57 Compare April 27, 2025 15:02
Copy link
Contributor

@apostasie apostasie left a comment

Choose a reason for hiding this comment

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

Thanks @SpiffyEight77

You should squash these commits.
One minor comment in there, but otherwise looks fine.

Paging @fahedouch for a formal maintainer review.

@SpiffyEight77 SpiffyEight77 force-pushed the feat/support-logs-details branch from a309b57 to d8ef366 Compare April 28, 2025 06:47
Copy link
Member

@fahedouch fahedouch left a comment

Choose a reason for hiding this comment

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

Thanks

@fahedouch fahedouch merged commit 017e286 into containerd:main Apr 29, 2025
52 of 53 checks passed
@SpiffyEight77 SpiffyEight77 deleted the feat/support-logs-details branch April 30, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants