-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
strip \r and \n when reading the file /etc/host_hostname #338
Conversation
@nvanheuverzwijn comments welcomed here |
@michaelshobbs Thank you Michael, I appreciate your work greatly ! Have an excellent day. |
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.
Probably not the right place to mention this, but I noticed {{.Hostname}}
doesn't work anymore in recent logspout versions. I think this is why.
func getHostname() string { | ||
content, err := ioutil.ReadFile("/etc/host_hostname") | ||
if err == nil && len(content) > 0 { | ||
hostname = strings.TrimRight(string(content), "\r\n") |
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.
This modifies the global hostname variable. Should we add a local declaration at the beginning of getHostname? (Or just return here instead of assigning the result?)
if err == nil && len(content) > 0 { | ||
hostname = strings.TrimRight(string(content), "\r\n") | ||
} else { | ||
hostname = getopt("SYSLOG_HOSTNAME", "{{.Container.Config.Hostname}}") |
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.
Same thing here.
@@ -69,13 +80,8 @@ func NewSyslogAdapter(route *router.Route) (router.LogAdapter, error) { | |||
format := getopt("SYSLOG_FORMAT", "rfc5424") | |||
priority := getopt("SYSLOG_PRIORITY", "{{.Priority}}") | |||
pid := getopt("SYSLOG_PID", "{{.Container.State.Pid}}") | |||
hostname = getHostname() |
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.
I think this would make more sense as :=
too.
@markdascher please file a new issue, rather than posting on an old pull request. |
also:
working_directory
so we don't have duplicate packagesalpine:3.6
in order to get golang 1.8.3DEBUG
to test containercloses #335