add log opts flag to pass in logging options#12422
Conversation
There was a problem hiding this comment.
Can you remove the commented lines?
There was a problem hiding this comment.
@ibuildthecloud I wanted to enforce a validation step at this point for the log options. The commented lines have a pattern for validating log options.
There was a problem hiding this comment.
Perhaps just a TODO? The commented code looks trivial
|
Shouldn't we pass this to logging drivers? |
There was a problem hiding this comment.
That would allow one to specify an option like --map-opt key=value1=value2 I cant think of a use case for something like that. Are there any potential benefits of doing that?
There was a problem hiding this comment.
Just checked runconfig/parse.go, and it does splitN with n=2. For consistency between docker run and docker -d, i'll make it splitN
|
Also tests for MapOpts needed. |
|
Thanks for splitting it, @wlan0! |
|
Why do you plan validation for daemon and not for run? |
|
@LK4D4 Addressed all your comments I think. Good catch btw, we need validation for docker daemon as well. Now there are,
|
There was a problem hiding this comment.
Is this basically strings.Contains check?
There was a problem hiding this comment.
Then I think better to use strings.Contains :)
There was a problem hiding this comment.
@LK4D4 This cannot be strings.Contains. strings.Contains will validate some-string=allowed-string, whereas we only want allowed-string=some-string to be valid.
|
@wlan0 what is this PR supposed to do? Just introduce log-opt and passing it to the logging driver and that's it? If that's the case I would remove references to |
|
@LK4D4 I've updated the code to initialize |
|
Code okay for me. I'm eager to see it's usage. |
|
FYI, Syslog implementation using |
|
@ibuildthecloud the PR you referenced doesn't use @LK4D4 I think I'd prefer in a separate PR, so we can merge this, but I don't really mind. |
There was a problem hiding this comment.
@LK4D4 why not use opts.NewListOpts with opts.ValidateEnv like --label ?
Also there are already functions like convertKVStringsToMap that we can reuse.
There was a problem hiding this comment.
Have no idea :/ Wanna carry this?
|
Lol, wrong PR, too many late night drunken pull requests. Here's the right one #12668 |
Signed-off-by: wlan0 <[email protected]>
There was a problem hiding this comment.
Nit: extra pair of parenthesis.
|
@wlan0 Can you please rebase? |
|
Thanks, code LGTM. |
|
@icecrime rebased. |
|
ah man so sorry needs rebase then you can ping me for review and merge thanks! |
|
@jfrazelle Rebased :) |
|
LGTM thanks! |
add log opts flag to pass in logging options
|
Thanks all! |
|
@LK4D4 @wlan0 so I can see that If one of you can provide more context I can start working on plumbing LoggingOpts to the logdrivers factory using logging.Context. |
There was a problem hiding this comment.
@wlan0 isn't this supposed to be &config.LogConfig.Config (not sure, just reading the code)
There was a problem hiding this comment.
@ahmetalpbalkan Config is a map, its already a reference type
As per the discussions on this -- https://github.com/docker/docker/pull/11485/files
I'm dividing #11485 into two Pull requests, one for log-opts and one for
max-sizeandmax-fileoptions.This is the PR for log-opts.
@ibuildthecloud
@tiborvass
@LK4D4