-
Notifications
You must be signed in to change notification settings - Fork 949
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
enhance: add ExtraAttribute functionality in LogInfo #1714
enhance: add ExtraAttribute functionality in LogInfo #1714
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1714 +/- ##
==========================================
+ Coverage 41.18% 41.27% +0.09%
==========================================
Files 274 274
Lines 18091 18123 +32
==========================================
+ Hits 7451 7481 +30
- Misses 9728 9730 +2
Partials 912 912
|
daemon/logger/info.go
Outdated
extra := make(map[string]string) | ||
|
||
// extra specific labels from container labels | ||
labels, ok := i.LogConfig["labels"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question, can we get which key --log-opt support?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about list available keys
flagSet.StringSliceVar(&c.logOpts, "log-opt", nil, "Log driver options")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The --log-opt
is inited by https://github.com/alibaba/pouch/blob/master/daemon/mgr/container_logger.go#L31
expected: "APP is <no value>", | ||
hasError: false, | ||
}, { | ||
tag: "{{with .ExtraAttributes nil}}Version is {{.VERSION}}{{end}}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about some {{with .ExtraAttributes notnil}} test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the go template doesn't support the function as args, I add other for the ExtractAttributes
.
BTW, the definition of ExtracAttributes
function which has the keyMod
is used to compatible with moby
.
Please take a look
Allow user to consume container's labels and envs data in log file. Signed-off-by: Wei Fu <fhfuwei@163.com>
lgtm |
Signed-off-by: Wei Fu fhfuwei@163.com
Ⅰ. Describe what this PR did
Allow user to consume container's labels and envs data in log file.
Ⅱ. Does this pull request fix one issue?
NONE
Ⅲ. Describe how you did it
Add
ExtraAttributes
function forInfo
so that we can use template to consume the data from container.Ⅳ. Describe how to verify it
We will get the log data in
/var/log/syslog
Ⅴ. Special notes for reviews