Skip to content

Add syslog-address log-opt#13392

Merged
calavera merged 1 commit intomoby:masterfrom
runcom:syslog-connection-url-log-opt
May 29, 2015
Merged

Add syslog-address log-opt#13392
calavera merged 1 commit intomoby:masterfrom
runcom:syslog-connection-url-log-opt

Conversation

@runcom
Copy link
Copy Markdown
Member

@runcom runcom commented May 21, 2015

Didn't add tests and docs yet, just want to agree on what I did here

This adds --log-opt syslog-address=tcp://127.0.0.1:514 to be able to specify a remote syslog server to log thinghies (suggestions regarding the name I've choosen are welcome if you don't like it)

I removed ValidateLogOpts because basically I think driver's specific opts shouldn't be checked in opts/opts.go otherwise it will be cluttered in no time and it's driver's business to handle its own opts.
But I still think it could be useful for drivers shared options like tag where docker could let people chose which field to use for the tag (like container or name for instance EDIT on this tag more info here: #12876 (comment))

ping @LK4D4 @duglin @thaJeztah

resolves #13362

Signed-off-by: Antonio Murdaca [email protected]

Comment thread daemon/logger/syslog/syslog.go Outdated
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.

Maybe just address?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

indeed...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

other drivers may have their own parsing routine to decide if address is correct

@thaJeztah
Copy link
Copy Markdown
Member

think driver's specific opts shouldn't be checked in opts/opts.go otherwise it will be cluttered in no time and it's driver business handling its own opts.

+1 makes sense

@runcom runcom force-pushed the syslog-connection-url-log-opt branch from 4920fa6 to 8ad17fd Compare May 21, 2015 20:30
Comment thread daemon/logger/syslog/syslog.go Outdated
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.

Isn't it working without this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

mmm I tried this morning and golang syslog.Dial was complaining about missing :514, will check again now gimme a minute

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yup isn't working w/o: panic: dial tcp: missing port in address localhost

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.

address + ":514"
Also see net.SplitHostPort, I think this would be better.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@cpuguy83 better to check if port isn't defined?

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.

Well, you are already doing that, but SplitHostPort is a bit more sophisticated and works with ipv6.

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.

Yeah, I think it's better, too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated thanks

@runcom runcom force-pushed the syslog-connection-url-log-opt branch from 8ad17fd to 261875e Compare May 21, 2015 20:45
@runcom runcom force-pushed the syslog-connection-url-log-opt branch from 261875e to 9baa64b Compare May 21, 2015 20:53
Comment thread daemon/logger/syslog/syslog.go Outdated
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.

Seems like it can return three types of error and your case only for one :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@LK4D4 thanks updated

@runcom runcom force-pushed the syslog-connection-url-log-opt branch 3 times, most recently from 59ecada to 7cc8d05 Compare May 21, 2015 21:42
Comment thread daemon/logger/syslog/syslog.go Outdated
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.

You should use + to concatenate strings instead of fmt.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

done both, overlooked your last comments sorry

@runcom runcom force-pushed the syslog-connection-url-log-opt branch 3 times, most recently from 6048313 to 23ae19d Compare May 22, 2015 18:32
@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented May 22, 2015

ping @docker/core-maintainers
It's superimportant feature.

@runcom runcom changed the title Add -log-opt for syslog connection url Add syslog-address log-opt May 22, 2015
@runcom runcom force-pushed the syslog-connection-url-log-opt branch 2 times, most recently from ef6916c to 5aec59d Compare May 25, 2015 19:40
@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 26, 2015

ping @cpuguy83 @duglin @calavera

Comment thread pkg/urlutil/url.go Outdated
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.

@runcom can you verify this will not relax IsURL checks for other callers?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

sure will do

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@tiborvass this will def relax IsURL so I'm gonna do that simple Prefix checks here in logger

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.

ok

@cpuguy83 cpuguy83 added this to the 1.7.0 milestone May 26, 2015
@cpuguy83
Copy link
Copy Markdown
Member

Adding to 1.7 milestone b/c I think this is super-important as well.

@cpuguy83
Copy link
Copy Markdown
Member

Also definitely +1 here.

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.

🎉 :)

@thaJeztah
Copy link
Copy Markdown
Member

Not completely happy with the "The following logging options are supported for this logging driver: [none]" sentences, but for now it should suffice 😄

LGTM

do we need another look at #13392 (comment)?

@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 27, 2015

@thaJeztah I borrowed that sentence from the previous docs but I'm sure we can change it later during a refactor (other pr are pulling in log driver options doc as well)

wrt that comment, I prefer to have a final go from them

@jberryman
Copy link
Copy Markdown

Having a bit of trouble following all the --log-driver discussions and have a couple questions:

  1. Does this support specifying an alternative socket file to /dev/log? (see my comment on the code above). This is something I need and have implemented in a fork.
  2. Can this be set per-container when doing run? (this would be nice for me)

@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 28, 2015

Comment thread docs/sources/reference/run.md Outdated
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.

tics around syslod and syslog in text.

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.

syslod is a typo, it should be syslogd.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yup noticed

@moxiegirl
Copy link
Copy Markdown
Contributor

With formatting changes, LGTM. Thank you for the contribution.

@runcom runcom force-pushed the syslog-connection-url-log-opt branch 2 times, most recently from 4fa10c1 to 1052f9c Compare May 28, 2015 22:22
@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 28, 2015

@jberryman updated this pr to include custom unix socket log options

ping @tiborvass @LK4D4 @cpuguy83 to have another last look on this since I updated code to include specifing a custom unix socket path

@icecrime
Copy link
Copy Markdown
Contributor

Moving back to code review then.

@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 28, 2015

thx @icecrime

@LK4D4
Copy link
Copy Markdown
Contributor

LK4D4 commented May 28, 2015

@runcom lol. need rebase :)

Comment thread docs/sources/reference/run.md Outdated
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.

i would split this in two for tcp|udp and unix, because of the host:port|path part

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

👍

@runcom runcom force-pushed the syslog-connection-url-log-opt branch from 1052f9c to ffd02f4 Compare May 28, 2015 22:28
Comment thread daemon/logger/syslog/syslog.go Outdated
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.

no need for extra variable

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

isn't cleaner not to use url.Path twice? or is that bad? or is ok, I'll change it :)

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.

it's a compiled language :)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah and I'm too used to dynamic ones doh

@runcom runcom force-pushed the syslog-connection-url-log-opt branch from ffd02f4 to 40fd8b1 Compare May 28, 2015 22:30
Signed-off-by: Antonio Murdaca <[email protected]>
@runcom runcom force-pushed the syslog-connection-url-log-opt branch from 40fd8b1 to e8c88d2 Compare May 28, 2015 22:42
@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 28, 2015

@tiborvass took care of your comments

@calavera
Copy link
Copy Markdown
Contributor

LGTM. Merging since it looks like it already went through docs review.

calavera added a commit that referenced this pull request May 29, 2015
@calavera calavera merged commit f1fed87 into moby:master May 29, 2015
@runcom runcom deleted the syslog-connection-url-log-opt branch May 29, 2015 17:24
@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 29, 2015

thanks guys 🎉

@runcom
Copy link
Copy Markdown
Member Author

runcom commented May 29, 2015

@jberryman now you could test the latest master code with this log-opt for unix socket :)

@jessfraz
Copy link
Copy Markdown
Contributor

cherry-picked \o/ thanks for assigning me

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.

Add UDP and TCP support to syslog log adapter