You can get the PID with https://golang.org/pkg/os/#Getpid and use that
you construct a string to hand in as tag to syslog.New.
On Thu, 2020-04-16 at 20:16 -0700, Dean Schulze wrote:
> I have a C program with a syslog command like this:
>
> syslog(LOG_INFO, "slurmctrld: initializing resources");
>
> It outputs the first line below in the syslog. This C code executes
> a golang binary that also does syslog commands:
>
> Syslogger, err = syslog.New(syslog.LOG_INFO, "slurmctld")
> ....
> Syslogger.Info("slurmctld: initializing resources - completed")
>
> The golang code writes the last 3 entries in the syslog, but they
> include a PID or thread id:
>
> Apr 16 19:18:37 slurmctld slurmctld: slurmctrld: initializing
> resources
> Apr 16 19:19:12 slurmctld slurmctld[24785]: slurmctrld: creating
> resource group
> Apr 16 19:19:15 slurmctld slurmctld[24785]: slurmctrld: creating
> machines
> Apr 16 19:20:28 slurmctld slurmctld[24785]: slurmctld: initializing
> resources - completed
>
> In golang is there a way to get syslog messages without the PID so
> they look the same as from C code?
>
> --
> You received this message because you are subscribed to the Google
> Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/18e63047-8b38-4276-8584-17d0a5714c21%40googlegroups.com
> .
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/d7e0ad94a9b527751ee702accc4468284313f643.camel%40kortschak.io.