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/syslog: writes hostname when using customized syslog socket because “unixgram” or “unix” are not recognized as local transports #41960
Labels
FrozenDueToAge
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Comments
ianlancetaylor
changed the title
Syslog writes hostname when using customized syslog socket
log/syslog: writes hostname when using customized syslog socket
Oct 14, 2020
ianlancetaylor
added
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
labels
Oct 14, 2020
imxyb
pushed a commit
to imxyb/go
that referenced
this issue
Oct 21, 2020
Closed
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 21, 2020
Signed-off-by: imxyb <xyb4638@gmail.com>
Closed
Change https://golang.org/cl/264081 mentions this issue: |
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 22, 2020
Fixes golang#41960 Signed-off-by: imxyb <xyb4638@gmail.com>
Change https://golang.org/cl/264297 mentions this issue: |
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 22, 2020
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 22, 2020
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 23, 2020
Fixes golang#41960 Signed-off-by: imxyb <xyb4638@gmail.com>
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 24, 2020
Fixes golang#41960 Signed-off-by: imxyb <xyb4638@gmail.com>
imxyb
added a commit
to imxyb/go
that referenced
this issue
Oct 25, 2020
Fixes golang#41960 Signed-off-by: imxyb <xyb4638@gmail.com>
odeke-em
changed the title
log/syslog: writes hostname when using customized syslog socket
log/syslog: writes hostname when using customized syslog socket because u
Oct 25, 2020
odeke-em
changed the title
log/syslog: writes hostname when using customized syslog socket because u
log/syslog: writes hostname when using customized syslog socket because “unixgram” or “unix” are not recognized as local transports
Oct 25, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
help wanted
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
syslog.New() uses default syslog socket "/dev/log". To specify socket path, syslog.Dial("unixgram", "/dev/log", ...) can be used. The behaviors should be the same but but they are not. Running the attached example code:
syslog_debug.go.txt
$ go run syslog_debug.go; tail /var/log/debug -n 100 | grep 'Syslog debug: logging with'
What did you expect to see?
Oct 9 17:13:33 foo.bar.com default[1804115]: Syslog debug: logging with default socket.
Oct 9 17:13:33 foo.bar.com customized[1804115]: Syslog debug: logging with customized socket.
What did you see instead?
Oct 9 17:13:33 foo.bar.com default[1804115]: Syslog debug: logging with default socket.
Oct 9 17:13:33 foo.bar.com foo.bar.com customized[1804115]: Syslog debug: logging with customized socket.
Host name appears twice in the customized socket. As a result, the hostname will be parsed as programname by rsyslogd.
The reason is that "unixgram" is not considered as a local socket in
https://golang.org/src/log/syslog/syslog.go, line 164:
field "local" will not be set if network is unixgram.
In https://golang.org/src/log/syslog/syslog.go, line 284:
If local is not set, the hostname will be output.
We need to run a dedicated syslog server in Linux. /dev/log cannot be used since it is used by other services.
The text was updated successfully, but these errors were encountered: