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

log: support --log-opt tag= #4805

Merged
merged 2 commits into from
Jan 10, 2020
Merged

Conversation

giuseppe
Copy link
Member

@giuseppe giuseppe commented Jan 7, 2020

support a custom tag to add to each log for the container.

Closes: #3653

Signed-off-by: Giuseppe Scrivano gscrivan@redhat.com

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 7, 2020
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Code LGTM but I'd love to have some tests and to extend the documentation a bit more.

pkg/spec/createconfig.go Outdated Show resolved Hide resolved

Specify a custom log tag for the container. For example:

`--log-opt tag="{{.ImageName}}"`
Copy link
Member

Choose a reason for hiding this comment

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

What's the format? What are valid keys and values?

Copy link
Member Author

Choose a reason for hiding this comment

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

specified in the man page

libpod/container_inspect.go Outdated Show resolved Hide resolved
@vrothberg
Copy link
Member

https://review.rdoproject.org/zuul/buildset/fb366dee96094ad4bb02d1c41fb211b6 is failing in other PRs as well. Do you know what that is?

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

pkg/spec/parse.go Outdated Show resolved Hide resolved
@mheon
Copy link
Member

mheon commented Jan 7, 2020

I'm starting to really hate Go templates, but if we need to do it, we need to do it. Found a few small things, but overall looks good.

@TomSweeneyRedHat
Copy link
Member

Tests aren't hip.
Other than the comments from @vrothberg and @mheon, LGTM

@rhatdan
Copy link
Member

rhatdan commented Jan 7, 2020

Is this something containers.conf should handle also?

libpod/container.go Outdated Show resolved Hide resolved
@giuseppe giuseppe force-pushed the log-tag branch 2 times, most recently from afcc651 to ab2acb4 Compare January 8, 2020 08:49
@rhatdan
Copy link
Member

rhatdan commented Jan 8, 2020

@giuseppe could you respond to all of the questions above?

@giuseppe
Copy link
Member Author

giuseppe commented Jan 8, 2020

@giuseppe could you respond to all of the questions above?

I was still looking into adding tests. We currently have all tests disabled for journald and checking whether the tag is correctly added will probably need to use journalctl.

Is this something containers.conf should handle also?

since it is backend specific, should we have a way to specify log_opt instead?

@rhatdan
Copy link
Member

rhatdan commented Jan 8, 2020

We have LogSizeMax which maybe should be changed to log_opt,since this seems to be specific to file.

@giuseppe
Copy link
Member Author

giuseppe commented Jan 8, 2020

comments are addressed, but tests are missing

support a custom tag to add to each log for the container.

It is currently supported only by the journald backend.

Closes: containers#3653

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
@giuseppe
Copy link
Member Author

added a test but the journald tests are not enabled in the e2e tests.

I'll try to enable them as a follow up PR

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2020

What error will I see if I try to use log-opt without journald?

@giuseppe
Copy link
Member Author

What error will I see if I try to use log-opt without journald?

right now it will be silently ignored. I think it should be fixed in conmon, I'll open a PR to address it

@giuseppe
Copy link
Member Author

right now it will be silently ignored. I think it should be fixed in conmon, I'll open a PR to address it

PR opened here: containers/conmon#115

@rhatdan
Copy link
Member

rhatdan commented Jan 10, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 10, 2020
@openshift-merge-robot openshift-merge-robot merged commit 0e9c208 into containers:master Jan 10, 2020
@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 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

journald driver: missing CONTAINER_TAG and not human readable CONTAINER_NAME
8 participants