Skip to content
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: Add the ability to suppress the [<pid>] part of a syslog point #12861

Closed
seamusmacgp opened this issue Oct 7, 2015 · 2 comments
Closed

Comments

@seamusmacgp
Copy link

The unix openlog() function call takes a parameter option:

void openlog(const char *ident, int option, int facility);

On of these controls whether or not PID of the process is included in the generated logpoint.

The bit from sys/syslog.h the controls this is:

define LOG_PID 0x01 /* log the pid with each message */

This may also be controlled from the command line logger utility using the command line option:

 -i       Log the process id of the logger process with each line.

This issue discusses extending the existing syslog package to allow this to be control.

The existing Go package includes the PID by default and doesn't offer a way to control it, this change would preserve the existing default and add two new methods

func (w *Writer) UnsetOptions(opt int)

To remove options and the other one:

func (w *Writer) SetOptions(opt int)

To add option bits.

Only one option bit would be added:

const (
// The syslog options, only OPT_PID is supported

    LOG_PID = 0x1

)

@ianlancetaylor ianlancetaylor changed the title Add the ability to suppress the [<pid>] part of a syslog point log/syslog: Add the ability to suppress the [<pid>] part of a syslog point Oct 7, 2015
@ianlancetaylor
Copy link
Contributor

I would vote no. I think we all regret adding the log/syslog package to the standard library. Adding more API surface just gives us more to maintain. It's a small package; if you want different behavior, copy it into your source tree.

@bradfitz
Copy link
Contributor

bradfitz commented Oct 7, 2015

I agree.

You should fork it to somewhere on github and make it the super full-featured syslog package.

@bradfitz bradfitz closed this as completed Oct 7, 2015
@golang golang locked and limited conversation to collaborators Oct 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants